Variables in JavaScript are, as the name suggests, anything whose values vary. In class, we pictured a variable as a box which is used to hold values. Now your next question maybe: “Why do we need variables?”. If you are using your name in a program many times over, it would be much more efficient to just store your name in a variable that you can use it later whenever required.
Some rules: a variable should begin with am underscore, dollar sign, or an alphabet letter. You can use a number digit after previously mentioned characters.
Leave a Reply
You must be logged in to post a comment.