Storing data in JavaScript isn't just about type, it's also about purpose. What do you want to do with the data? Or more specifically, will the data change throughout the course of your script? The answers determine whether you code your data type in JavaScript as a variable or a constant.
A variable changes throughout the course of a script, while a constant never changes its value.
No comments:
Post a Comment