JavaScript 内置对象
Boolean
创建方式
属性
方法
- toString()
- valueOf() 返回原始值
Number
创建方式
属性
- Number.MAX_VALUE
- Number.MIN_VALUE
方法
- toFixed() 保留指定位数的小数, 默认保留整数
- toExponential() 用科学计数法形式来表示
- toString() 转为字符串。 可以把十进制转换为任意进制的字符串
String
创建方式
属性
方法
- charAt(index) 返回指定位置的字符,可以用[]运算符代替
- charCodeAt(index) 返回指定位置的字符的编码
- String.fromCharCode() 把unicode编码转换为 字符
- concat() 连接一个或多字字符串,可以被+运算符代替
- indexOf() 返回字符(串)在字符串中第一次出现的位置
- lastIndexOf() 返回字符(串)在字符串中最后一次出现的位置
- substr(start [, length]) 截取字符串
- substring(start [, end]) 截取字符串
- slice() 同 substring
- split() 把字符串分割成数组 根数组方式 arr.join() 相反
- toUpperCase() 把字符串转换为大写
- toLowerCase() 把字符串转换为小写
- trim() 去除字符串两边的空格
- replace()
- match()
- search()
Date
创建date
方法
- getYear()
- getFullYear() 公元纪年
- getMonth() 从0开始
- getDay()
- getDate()
- getHours()
- getMinutes()
- getSeconds()
- getMilliseconds()
- getTime() 从1970年1月1日0时0分0秒 至今的毫秒数
- getTimezoneOffset() 与标准时区的偏移量单位是分钟
- getUTC.....
- set...
- setUTC...
- toUTCStirng()
时间戳
- 从Unix元年至今的秒数或毫秒数
- Unix元年 1970年
Math
属性
方法
- abs() 求绝对值
- sqrt() 求平方根
- pow() 求几次方
- max() 求最大值
- min() 求最小值
- round() 四舍五入取整
- floor() 舍一取整
- ceil() 进一取整
定时函数
多次定时
- setInterval()
- clearInterval()
单次定时
- setTimeout()
- clearTimeout()
Array
属性
方法
- concat()
- join()
- slice()
- reverse()
- push()
- pop()
- shift()
- unshift()
- splice()
- sort()
ECMA5 新增的方法
- forEach()
- map()
- filter()
- every()
- some()
- indexOf()
- lastIndexOf()
内置对象 Function
属性
方法
- apply()
- call()
- bind() ECMA5新增
原文地址:https://www.cnblogs.com/kyl-6/p/7425450.html