1、JavaScript的数字都为64位,整数最多15位,小数最多17位
属性:
MAX VALUE、MIN VALUE、NEGATIVE INFINITIVE、POSITIVE INFINITIVE、NaN、prototype、constructor
方法:
toExponential()、toFixed()、toPrecision()、toString()、valueOf()
2、字符串
求长度:txt.length
变大写:txt.toUpperCase()
样式:txt.***()
3、日期 var myDate=newDate()
getTime():getTime() 返回从 1970 年 1 月 1 日至今的毫秒数。
setFullYear():myDate.setFullYear(2008,7,9)
toUTCString():如何使用 toUTCString() 将当日的日期(根据 UTC)转换为字符串。
getDay():获取星期几
4、数组
arr1.concat(arr2):合并两个数组,arr1与arr2
arr.join("."):用数组的信息组成字符串
数字和文本的sort排序
5、boolean
如果逻辑对象无初始值或者其值为 0、-0、null、""、false、undefined 或者 NaN,那么对象的值为 false
6、Math对象
Math.round(number):四舍五入
Math.random():0~1的随机数
Math.floor(Math.random()*11):0~10之间的随机数
max()、min()
7、正则表达式 RegExp对象 var patt1=new RegExp("e");第二个参数为【g】golbal search
test()、exec() 以及 compile()
test() 方法检索字符串中的指定值true or false:patt1.test("The best things in life are free")
exec() 方法检索字符串中的指定值。返回值是被找到的值。如果没有发现匹配,则返回 null
compile() 方法用于改变 RegExp,既可以改变检索模式,也可以添加或删除第二个参数
网友评论