A
A
Andrew2017-09-18 09:29:16
JavaScript
Andrew, 2017-09-18 09:29:16

What kind of code to write all the same, short or painted?

When you write code and time is running out, you want to make your code better, for example, wrap a couple of repeated lines in a loop, but what to choose, does it make it difficult to read? example:
prntscr.com/gmgzy5

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Egor Zhivagin, 2017-09-18
@Krasnodar_etc

The abbreviated version looks more readable)
Do better, cleaner, if it simplifies. Several elements of the array are displayed - go through the loop, it's logical. The main thing is to feel the line between "easier" and "less characters"

⚡ Kotobotov ⚡, 2017-09-19
@angrySCV

Damn dude, here you are focusing attention from important things to completely unimportant ones.
That's what you want to achieve -> write understandable code?
well, so it’s not at all clear to you, what is “splitText[0]”, what is “splitText[1]”, for good you need to pass an object, and refer specifically to names -> for example “text.quench”, " text.date".
Wrapping 2 repeating lines in a loop is NOT NECESSARY, well, if you want to wrap it, it doesn’t really affect anything, well, do it as you like.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question