Is there a convention for naming variables?
by rblampain from LinuxQuestions.org on (#5S0VY)
When one has to name variables in different contexts, is there a prevailing convention to prefix the variable with a notation indicating where it belongs?
For example, variable contents are passed between Javascript, Local Storage, HTML(forms) and server side scripts.
I got into the habit, possibly a bad habit, of making the variable name slightly different for fear of any conflict when there may be no conflict possible.
If not and if useful, is it an idea to copy the "hungarian notation", which prefixes a variable name with "s" for string, "i" for integer etc and starting the variable name with a capital letter? In my simplistic reasoning, the variable name can be prefixed with "js" or "lc" or "ht" etc (perhaps already applied in "good programming").
Thank you for your help.
For example, variable contents are passed between Javascript, Local Storage, HTML(forms) and server side scripts.
I got into the habit, possibly a bad habit, of making the variable name slightly different for fear of any conflict when there may be no conflict possible.
If not and if useful, is it an idea to copy the "hungarian notation", which prefixes a variable name with "s" for string, "i" for integer etc and starting the variable name with a capital letter? In my simplistic reasoning, the variable name can be prefixed with "js" or "lc" or "ht" etc (perhaps already applied in "good programming").
Thank you for your help.