HTML Diff
0 added 0 removed
Original 2026-01-01
Modified 2026-03-09
1 <p>The program has received the data and it needs to save it somewhere for future use. To do this, we first need to deal with<em>processing</em>of data. It is obvious that the data is saved in the computer’s memory. Memory is a complex structure using complex addresses. In the past, memory operations looked like this:</p>
1 <p>The program has received the data and it needs to save it somewhere for future use. To do this, we first need to deal with<em>processing</em>of data. It is obvious that the data is saved in the computer’s memory. Memory is a complex structure using complex addresses. In the past, memory operations looked like this:</p>
2 put 0xEC002...0xEC003 1 // saved number 1 to a memory cell get 0xEC002...0xEC003 // loaded number 1 from a memory cell<p>It’s very inconvenient to constantly use these complicated addresses. It’s very hard to memorize what was saved and why. This is why lazy developers came up with a simple solution: variables.</p>
2 put 0xEC002...0xEC003 1 // saved number 1 to a memory cell get 0xEC002...0xEC003 // loaded number 1 from a memory cell<p>It’s very inconvenient to constantly use these complicated addresses. It’s very hard to memorize what was saved and why. This is why lazy developers came up with a simple solution: variables.</p>
3 put my_number 1 // saved number 1 to the variable my_number get my_number // loaded number 1 from the variable my_number<p>A variable is just a name for data that can be made understandable to people. And this name can be written in different ways. These are the two of the most common ways: camelCase (camel notation) and snake_case (snake notation). In the first case, all words in the variable name are written together and each new word begins with a capital letter (myNumber, userName). In the second case, all words are separated by underscore (my_number, my_name). In the courses, we will use camelCase and write the names of variables exactly like this.</p>
3 put my_number 1 // saved number 1 to the variable my_number get my_number // loaded number 1 from the variable my_number<p>A variable is just a name for data that can be made understandable to people. And this name can be written in different ways. These are the two of the most common ways: camelCase (camel notation) and snake_case (snake notation). In the first case, all words in the variable name are written together and each new word begins with a capital letter (myNumber, userName). In the second case, all words are separated by underscore (my_number, my_name). In the courses, we will use camelCase and write the names of variables exactly like this.</p>
4 <p>Variables simplify memory operations: they stick to memory cells like a name sticker does to a document folder. Variables let you save, retrieve and modify data.</p>
4 <p>Variables simplify memory operations: they stick to memory cells like a name sticker does to a document folder. Variables let you save, retrieve and modify data.</p>
5 <p>In JavaScript, variables can be created using the var command followed by the name of a variable:</p>
5 <p>In JavaScript, variables can be created using the var command followed by the name of a variable:</p>
6 var variableName;<p>After creating a variable, you can use it in other commands and output it to the console:</p>
6 var variableName;<p>After creating a variable, you can use it in other commands and output it to the console:</p>
7 // Please note that there are no quotes here! console.log(variableName);
7 // Please note that there are no quotes here! console.log(variableName);