learning PROGRAMMING

(through Javascript)

Variable DEFINition



    var message = "Hello World"; // string
    var pie = 3.14; // number 
    var num = 1 + 2.3;
    

takes the format: 
 variable_name = expression;

PRINTING STRINGS



    alert("Hello!");
    
RESULT:
 

Tying them together


   var message = "Hello World!";
   alert(message);
   
Result:

QUESTION 1

How would we define a variable which contains the sum of 2 and 8 and then print that out to the screen?




QUESTIONS?

learning javascript

By Benjamin Kaiser

learning javascript

  • 1,956