1var user_name = prompt("Please enter your name:", "Type here");
2alert("Hello " + user_name);
1//choose the best for your solution
2var myVariable = 22; //this can be a string or number. var is globally defined
3
4let myVariable = 22; //this can be a string or number. let is block scoped
5
6const myVariable = 22; //this can be a string or number. const is block scoped and
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 Number = 5;
2var String = "Hi!";
3var boolen1 = true;
4var boolen2 = false;
5var array = [11, "Hi!", true];
6var object = {age:11, speach:"Hi!", likes_Bananas:true};
1 var text = "";
2var i;
3for (i = 0; i < 5; i++) {
4 text += "The number is " + i + "<br>";
5}
1var is a keyword to define the varible in js but as of es-6 we, use let and const keywords for the same