The browser storage localStorage is not available. Either your browser does not support it or you have disabled it or the maximum memory size is exceeded. Without localStorage your solutions will not be stored.
Variables
JavaScript programs consist of a series of statements.
Each statement performs an elementary operation.
By executing many instructions you can finally solve complex tasks.
Each statement is written in a line and closed with a semicolon.
An elementary statement is the declaration and initialization of a variable. A variable is a container for a value. The statement
An elementary statement is the declaration and initialization of a variable. A variable is a container for a value. The statement
let city = 'Porbandar';
declares a variable with the name city
and initializes it with the value 'Porbandar'
.
The variable is declared with the keyword let
.
Use the equals sign, the assignment operator, to assign a value to the variable.
Note: JavaScript is case-sensitive. city
and City
are two different variables.Exercise
Declare a variable
firstname
and initialize it with the value 'Lata'
.
+ Hint
let firstname = ...
+ Solution
let firstname = 'Lata';