var s1 ="some text"
s1.color="red";
alert(s1.color); //undefined
var value="25";
var number =Number(value); //转为函数
alert(typeof number ) //number
var obj =new Number(value);
alert(typeof obj) //object
var falseObject =new Boolean(false);
var result falseObject && true;
alert(result) //true
var falseValue =false;
result =falseValue && true;
alert(result); //false;
//toString()方法传递一个表达基数的参数,告诉它返回几进制数值的字符串,
var num =10;
alert(num.toString());//10
alert(num.toString(2));//1010
alert(num.toString(8));//12
alert(num.toString(10));//10
alert(num.toString(16));//a
toFixd()方法会按照指定的小数位返回数值的字符串表示
var num =10;
alert(num.toFixed(2)); //"10.00"
var num1 = 10.005;
alert(num1.toFixed(2));
var stringValue ="hello world";
alert(stringValue.slice(3)) //lo world
alert(stringValue.substring(3)) //lo world
alert(stringValue.substr(3)) //lo world
alert(stringValue.slice(3,7)) //lo w
alert(stringValue.substring(3,7)) //lo w
alert(stringValue.substr(3,7)) //lo worl
---------------
var stringValue ="hello world";
alert(stringValue.slice(-3)) //rld
alert(stringValue.substring(-3)) //hello world
alert(stringValue.substr(-3)) //rld
alert(stringValue.slice(3,-4)) //lo w
alert(stringValue.substring(3,-4)) //hel
alert(stringValue.substr(3,-4)) //""
------------------
var stringValue ="hello world";
alert(stringValue.toLocaleUpperCase()); //HELLO WOERL
alert(stringValue.toUpperCase()) //HELLO WOERL
alert(stringValue.toLocaleLowerCase()) //hello world
alert(stringValue.toLowerCase()) //hello world
s1.color="red";
alert(s1.color); //undefined
var value="25";
var number =Number(value); //转为函数
alert(typeof number ) //number
var obj =new Number(value);
alert(typeof obj) //object
var falseObject =new Boolean(false);
var result falseObject && true;
alert(result) //true
var falseValue =false;
result =falseValue && true;
alert(result); //false;
//toString()方法传递一个表达基数的参数,告诉它返回几进制数值的字符串,
var num =10;
alert(num.toString());//10
alert(num.toString(2));//1010
alert(num.toString(8));//12
alert(num.toString(10));//10
alert(num.toString(16));//a
toFixd()方法会按照指定的小数位返回数值的字符串表示
var num =10;
alert(num.toFixed(2)); //"10.00"
var num1 = 10.005;
alert(num1.toFixed(2));
var stringValue ="hello world";
alert(stringValue.slice(3)) //lo world
alert(stringValue.substring(3)) //lo world
alert(stringValue.substr(3)) //lo world
alert(stringValue.slice(3,7)) //lo w
alert(stringValue.substring(3,7)) //lo w
alert(stringValue.substr(3,7)) //lo worl
---------------
var stringValue ="hello world";
alert(stringValue.slice(-3)) //rld
alert(stringValue.substring(-3)) //hello world
alert(stringValue.substr(-3)) //rld
alert(stringValue.slice(3,-4)) //lo w
alert(stringValue.substring(3,-4)) //hel
alert(stringValue.substr(3,-4)) //""
------------------
var stringValue ="hello world";
alert(stringValue.toLocaleUpperCase()); //HELLO WOERL
alert(stringValue.toUpperCase()) //HELLO WOERL
alert(stringValue.toLocaleLowerCase()) //hello world
alert(stringValue.toLowerCase()) //hello world