1var variable = 10;
2
3function start() {
4 variable = 20;
5}
6console.log(variable + 20);
7
8// Answer will be 40 since the variable was changed in the function
1var a;
2console.log(a); // scrive in console "undefined" o "" a seconda del browser usato.
3console.log('still going...'); // scrive in console "still going...".
1var myString = "string"; //var can be redefined
2var myInt = 34; //var can be redefined
3const myString2 = "string"; //const cannot be redefined
4const myInt2 = 69; //const cannot be redefined
1////We can define variables in 3 ways {var,let,const}///////
2////syntax- var variable_name=value;
3///// let variable_name=value;
4/////const variable_name=value;
5
6var myfristvariable="neha jaiswal";
7const mysecondvariable=80;
8let mythirdvar=abc;
9