String
- charAt(idx) 返回指定位置的字符
- indexOf(idx) 返回指定字符串的位置,顺序查找从左到右,如果找不到,则返回-1
- substr(m,n) 返回指定字符串 从m位置开始截取n个字符。如果参数n省略,则取到字符串末尾
- substring(m,n) 返回指定字符串 从m位置开始,到n位置结束,如果参数n省略,则取到字符串末尾
- toLowerCase() 将字符串中的字符全部转化为小写
- toUpperCase() 将字符串中的字符全部转化为大写
- length() 返回字符串的长度。
Math
- Math.random() 随机数
- Math.ceil() 向上取整,大于最大整数
- Math.floor() 向下取整,小于最小整数String
Date
Date
Date
-
//获取日期
- getFullYear() 年
- getMonth() 月 得到的值 0-11
- getDate() 日
- getHours() 时
- getMinutes() 分
- getSeconds() 秒
-
//设置日期
- setYear()
- setMonth()
- setDate()
- setHours()
- setMinutes()
- setSeconds()
- toLocaleString() 转换成本地时间字符串