Variables declaration performances | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 2

Variables declaration performances

Is there any performance advantage to declare multiple variables behind only one var tag? Like below: var var1, var2, var3,...;

19th Mar 2017, 3:15 PM
Geoffrey L
Geoffrey L - avatar
2 ответов
+ 4
yes. The browser will read the declaration at once, instead of checking line by line. Also, i's more organized by the way.
19th Mar 2017, 3:18 PM
Welliton Malta
Welliton Malta - avatar
+ 1
Yeah! That's what I was hopping... I'm trying to improve performance on my code (can find on my profil). It works well but I try to use it to practice optimisation of memory and fast refresh of canvas displays.
19th Mar 2017, 3:21 PM
Geoffrey L
Geoffrey L - avatar