May 15, 2010

number, string , boolean conversion

var n = 1;
var s = "" + n; //number to string
//or
String(n);
//
n = +s;  //string to number
//
n = Number(s); //

//to convert to boolean
Boolean(value);
//or
!!