Let's try : Javascript - Variables(Correct variable name)

in #ua6 years ago (edited)


Javascript - Variables(Correct variable name)
Javascript - Змінні(Правильне ім'я змінної)




//example 1 | приклад 1;
var var1;
var name;
var currentuser;
var currentUserName;
var current_user_name;
Variables names
Імена змінних
Why is it important to call the variables right? And what does it mean to name the variable correctly? Probably many miss this point, for example, a variable, to save the amount of cargo for transportation just item1, or var1 or even more interesting L instead of for example, amountOfCargo. As you can see, the difference is large and tells us the contents of the data to be saved. Maybe for not big projects it is not essential, but for big projects it may easy your work. Чому важливо називати змінні правильно?І що саме означає назвати змінну правильно?? Напевне багато хто пропускає цей момент, називаючи наприклад змінну, для збереження кількості вантажу для перевезення просто item1, або var1 або ще цікавіше L замість ну для прикладу amountOfCargo. Як бачите різниця велике та вказує нам на вміст данних для збереження. Можливо для не великиких проектів це не суттєво , та для великих проектів це неаби як полегшує вашу роботу.
Terms of Use
Правила іменування

1. No transliteration. Only English. - Most likely, your code wants someone to use it, or fix it, and imagine his surprise when this person, being a foreigner, does not understand the meaning of the names. Therefore, use pure English names.
2. Use short names only locally. In functions of yours application, whose variables names are logical underst, can use short names.
3. The name of the variable should describe its contents as much as possible. That is, if you save the height of the screen in the variable, name it screenHeight or screen_height. The first entry will be more expedient because it is shorter. Next, by analogy, all names where there is a decile of words call it is like (- camelCase). Examples:

1.Ніякого трансліта. Тільки англійський. - скоріш за все з вашим кодом захоче хтось скористатись , або виправити, і уявіть його здивування коли ця людина будучи іноземцем не зрозуміє сенсу назв.Тому використовуйте чисто англійські назви.
2.Використовуйте короткі імена лише локально. В середині функцій, вашого апі застосунку, змінні значення яких логічно зрозуміле можете використовувати короткі назви.
3.Назва змінної повинна максимально описувати її вміст. Тобто якщо ви у змінній зберігаєте висоту екрану , НАЗВІТЬ її screenHeight або screen_height . Перший запис буде більш доцільніший оскільки коротший.Тобто далі по аналогії всі імена де є декілка слів називайтеОсьТак ( - camelCase ).Приклади:
//example 2 | приклад 2;
var currentUserName="John",
      currentUserReputation=45,
      userBrowser="Firefox",
      pathToUserPhoto="url\to\photo";


Дану інформацію ви також знайдете на теренах інтернету.
Інформація буде корисною новачкам, та тим бажає розібратись в цьому питанні.
СТАВТЕ ПАЛЕЦЬ У ВЕРХ!!! ПІДПИСУЙТЕСЬ!!!
КОМЕНТУЙТЕ!!!

You will also find this information on the Internet.
The information will be useful to newcomers.
SUBSCRIBE !!!COMMENT !!!



image source/джерело картинки


Sort:  

Hello! Your post has been resteemed and upvoted by @ilovecoding because we love coding! Keep up good work! Consider upvoting this comment to support the @ilovecoding and increase your future rewards! ^_^ Steem On!

Reply !stop to disable the comment. Thanks!

Coin Marketplace

STEEM 0.19
TRX 0.15
JST 0.029
BTC 63498.69
ETH 2645.91
USDT 1.00
SBD 2.80