javascript内置对象有哪些?
reg正则,booer,math,string,arr,obj,number,date,function,window全局,error,json
在这些对象的原型上有一些方法,可以到这个网站查看http://lzw.me/pages/ecmascript/。
我下面罗列一些比较有用的
对数组的操作方法,
Array.prototype.toString ( )
Array.prototype.toLocaleString ( )
Array.prototype.concat ( [ item1 [ , item2 [ , … ] ] ] )
Array.prototype.join (separator)
Array.prototype.push ( [ item1 [ , item2 [ , … ] ] ] )
Array.prototype.pop ( )
Array.prototype.reverse ( )
Array.prototype.reduceRight ( callbackfn [ , initialValue ] )
Array.prototype.reduce ( callbackfn [ , initialValue ] )
Array.prototype.shift ( )
Array.prototype.slice (start, end)
Array.prototype.sort (comparefn)
Array.prototype.forEach ( callbackfn [ , thisArg ] )
Array.prototype.every ( callbackfn [ , thisArg ] )
Array.prototype.some ( callbackfn [ , thisArg ] )
Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
Array.prototype.indexOf ( searchElement [ , fromIndex ] )
Array.prototype.unshift ( [ item1 [ , item2 [ , … ] ] ] )
Array.prototype.splice (start, deleteCount [ , item1 [ , item2 [ , … ] ] ] )
Array.prototype.map ( callbackfn [ , thisArg ] )
Array.prototype.filter ( callbackfn [ , thisArg ] )
对字符串的操作方法
String.prototype.toString ( )
String.prototype.trim ( )
String.prototype.toLocaleUpperCase ( )
String.prototype.toUpperCase ( )
String.prototype.toLocaleLowerCase ( )
String.prototype.toLowerCase ( )
String.prototype.substring (start, end)
String.prototype.split (separator, limit)
String.prototype.slice (start, end)
String.prototype.search (regexp)
String.prototype.replace (searchValue, replaceValue)
String.prototype.match (regexp)
String.prototype.localeCompare (that)
String.prototype.lastIndexOf (searchString, position)
String.prototype.indexOf (searchString, position)
String.prototype.valueOf ( )
String.prototype.concat ( [ string1 [ , string2 [ , … ] ] ] )
String.prototype.charAt (pos)
String.prototype.charCodeAt (pos)
String.prototype.substr(start, length)
math
max ( [ value1 [ , value2 [ , … ] ] ] )
min ( [ value1 [ , value2 [ , … ] ] ] )
pow (x, y)
本文分享自 交互设计前端开发与后端程序设计 微信公众号,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文参与 腾讯云自媒体同步曝光计划 ,欢迎热爱写作的你一起参与!