Skip to content

Variables And Operations

fabiantheblind edited this page Nov 19, 2015 · 2 revisions

Variables should have meaningful names as in the examples below ;) ####Variables

var a = "Hello World!";//Strings

var b = 5.5;//Numbers

var c = true;//Boolean

####Operations

    /*
    You can use operators to transform variables
    + - * / % = . ++ -- += -= *= /= 
    like this 
    */
    
    var a = 10000;
    var b = 356;
    var res = b / a;
    alert(res);

    alert((5%4) + " modulo?"); // modulo

    var calc = (a/100)*13; 
    alert(calc);
    var str = "Hi there buddy!" + "\n" + "The result is: ";
    alert(str + calc);
    calc+=5;
    calc++;
    calc--;
    calc = calc + 5;
    alert(calc);
Clone this wiki locally