You are on page 1of 1

"string"

'string'.length // ' and " can both be used for strings


"fajksdas"+"jaskdas"+var+"djkasldjla"
3 + 4
4/5 = 0.8
//comments
/*blockcomments*/
confirm('text'); //popup with 'ok' and 'cancel' returns true or false
prompt("text"); //returns input from text box popup
console.log( variable ) //displays to console
<, >, <=, >=, ===, !==
1 == '1' TRUE //type conversion
1 === '1' FALSE //no type conversion
//if else are same as C
'string'.substring(1,5); // 'tring'
.toUpperCase()
.toLowerCase()
var varName = data;
var funName = function(argument1,argument2){
//donothing
}
for(var counter = 1; counter<11; counter++){
}
var mixed = [34, "candy", "blue", 11]; //arrays can store different data types
array.push(whattopush)
/*jshint multistr:true */ //<- add this so console knows there is line wrapping
Math.floor, math.random
String(casttostring)
isNaN(var) //check to see if variable is not a number
&& || !
var emptyObj = {};
var myObj = new Object();
myObj["name"] = "Charlie";
myObj.name = "Charlie";
var myObject = {
key1: value,
key2: value,
key3: value
};
for (var key in object)

You might also like