filmov
tv
8. JavaScript variables. Explaining with examples.

Показать описание
A variable is a “named storage” for data. We can use variables to store goodies, visitors, and other data.
To create a variable in JavaScript, use the let keyword. In older scripts, you may also find another keyword: var instead of let. The var keyword is almost the same as let. It also declares a variable, but in a slightly different, “old-school” way.
There are two limitations on variable names in JavaScript:
1. The name must contain only letters, digits, or the symbols $ and _.
2. The first character must not be a digit.
When the name contains multiple words, camelCase is commonly used. That is: words go one after another, each word except first starting with a capital letter: myVeryLongName.
Let's be friends:
To create a variable in JavaScript, use the let keyword. In older scripts, you may also find another keyword: var instead of let. The var keyword is almost the same as let. It also declares a variable, but in a slightly different, “old-school” way.
There are two limitations on variable names in JavaScript:
1. The name must contain only letters, digits, or the symbols $ and _.
2. The first character must not be a digit.
When the name contains multiple words, camelCase is commonly used. That is: words go one after another, each word except first starting with a capital letter: myVeryLongName.
Let's be friends: