JavaScript Variable
JavaScript Variable
var myName = "Aram"; /* var as a keyword and myName as avariable name and then = "Aram" as a
value;*/
var yourName = prompt("What is Your Name?"); /* The variable value is created or imported from
anything that we inserted on the prompt */
console.log(yourName); /* and when we console.log the variable, it'll show the value that we
inserted on the prompt */
/* now if we try to make an alert like a welcome message it will be like this: */
alert("Hello, my name is " + myName + ", and welcome to my page " + yourName + "!"); /* if you're
typing a text, then use string with the "". but if you want to call a variable, you just need the name of
that variable you wanted to call */
/* for information, you can't name variable that begin with a number typed first, it must an alphabet
at first. Example : var a1 = "value"; and also no space in naming variable, ONLY: alphabet, numeric,
and undercore (a1_)*/