String对象
1.常用方法
a.substr: 截取字符串 两个参数第一个是下标,第二个是长度
b.substring: 截取字符串 两个参数第一个是下标,第二个是下标
c.toUppercase:转换为大写
d.toLowercase:转换为小写
Number
1.常用方法
a.random();获取随机数
b.ceil();返回大于等于次数的最大整数
c.floor();返回小于等于次数的最大整数
d.round();返回四舍五入后的整数
Math
/*
Math对象: 1.floor(x): 取得小于等于x的最大整数
2.ceil(x) :取得大于于等于x的最大整数
3.random(): 取得0~1之间的随机数(可以等于0,永远不能取得1)
4.round(): 四舍五入为整数
*/
var a = 3.1;
alert(Math.floor(a)) ;
alert(Math.ceil(a)) ;
alert(Math.round(a))
Date
/*
Date对象:1.拿到当前时间:new Date() ;
2.拿到年月日,时分秒: getXXX() ;
*/
var d = new Date() ;
alert(d.toLocaleString()) ;
alert(d.getYear()) ;
alert(d.getMonth());
alert(d.getDate()) ;
alert(d.getDay()) ;