原生JavaScript中对象相关API合集-对象篇
现在jQuery已经没有那么有优势了,原生JS赶紧学起来😄
附:
👉原生JS中DOM节点相关API合集-DOM操作篇
👉原生JS中CSS相关API合集-CSS操作篇
Object对象
生成实例对象
属性
方法
Object.keys(o) Object.getOwnPropertyName(o)
|
对象实例的方法
valueOf toString toLocaleString hasOwnProperty isPrototypeOf propertyIsEnumerable
|
Array对象
生成实例对象
属性
Array.isArray()
Array实例的方法
a.valueof() a.toString() a.push(value,vlaue....) pop() join() concat() shift() unshift(value) reverse() slice(start_index, upto_index); splice(index, count_to_remove, addElement1, addElement2, ...); sort() map() map(elem,index,arr) forEach() filter() some() every() reduce() reduceRight() indexOf(s) lastIndexOf()
|
Number对象
生成对象
Number对象的属性
Number.POSITIVE_INFINITY Number.NEGATIVE_INFINITY Number.NaN Number.MAX_VALUE Number.MIN_VALUE Number.MAX_SAFE_INTEGER Number.MIN_SAFE_INTEGER
|
Number对象实例的方法
toString() toFixed() toExponential() toPrecision()
|
String 对象
生成实例对象
String对象的属性
方法
s.chatAt(index) s.fromCharCode() s.charCodeAt(index) s.concat(s2) s.slice(start,end) s.substring(start,end) s.substr(start,length) s.indexOf(s) s.lastIndexOf() s.trim() s.toLowerCase() s.toUpperCase() s.localeCompare(s2) s.match(regexp) s.search() s.replace(oldValue,newValue) s.split()
|
Math对象
属性
Math.E Math.LN2 Math.LN10 Math.LOG2E Math.LOG10E Math.PI Math.SQRT1_2 Math.SQRT2
|
数学方法
Math.abs() Math.ceil() Math.floor() Math.max(n,n1,...) Math.min(n,n1,..) Math.pow(n,e) Math.sqrt() Math.log() Math.exp() Math.round() Math.random()
|
三角函数方法
Math.sin() Math.cos() Math.tan() Math.asin() Math.acos() Math.atan()
|
JSON对象
方法
JSON.stringify() JSON.parse()
|
console对象
方法
console.log(text,text2,...) console.info() console.debug() console.warn() console.error() console.table() console.count() console.dir() console.dirxml() console.assert() console.time() console.timeEnd() console.profile() console.profileEnd() console.group() console.groupend() console.groupCollapsed() console.trace() console.clear()
|
About
GitHub:👉 github.com/microzz
个人网站:👉 microzz.com/