JS
Array Boolean Class Date Error Global JSON Math Number RegExp String 对象 运算符 语句 类型化数组
Array
| 方法 | |
|---|---|
| 遍历 | forEach() entries() keys() values() valueOf() |
| 改变数组 | push() pop() unshift() shift() splice() fill() reverse() sort() |
| 返回新数组 | map() filter() slice() concat() |
| 变更类型 | from() toString() join() |
| 查找、判断 | find() findIndex() includes() indexOf() lastIndexOf() every() some() isArray() |
| 累积和、累积乘积 | reduce() reduceRight() |
| copyWithin() |
Boolean
constructor prototype
toString() valueOf()
Class
constructor()
extends static super
Date
getDate() getDay() getFullYear() getHours() getMilliseconds() getMinutes() getMonth() getSeconds() getTime() getTimezoneOffset() getUTCDate() getUTCDay() getUTCFullYear() getUTCHours() getUTCMilliseconds() getUTCMinutes() getUTCMonth() getUTCSeconds() getYear() now() parse() setDate() setFullYear() setHours() setMilliseconds() setMinutes() setMonth() setSeconds() setTime() setUTCDate() setUTCFullYear() setUTCHours() setUTCMilliseconds() setUTCMinutes() setUTCMonth() setUTCSeconds() setYear() toDateString() toGMTString() toISOString() toJSON() toLocaleDateString() toLocaleTimeString() toLocaleString() toString() toTimeString() toUTCString() UTC() valueOf()
Error
name name
Global
Infinity NaN undefined
decodeURI() decodeURIComponent() encodeURI() encodeURIComponent() eval() isFinite() isNaN() Number() parseFloat() parseInt() String()
JSON
parse() stringify()
Math
| 示例 | 值 | ||
|---|---|---|---|
| 绝对值 | abs(x) | Math.abs(-2) | 2 |
| 平方立方 | sqrt(x) | Math.sqrt(9) | 3 |
| cbrt(x) | Math.cbrt(1000) | 10 | |
| 四舍五入 | ceil(x) | Math.ceil(1.1) | 2 |
| floor(x) | Math.floor(1.9) | 1 | |
| round(x) | Math.round(1.4) | 1 | |
| Math.round(1.5) | 2 | ||
| 对数 | log2(x) | Math.log2(8) | 3 |
| log10(x) | Math.log10(100) | 2 | |
| 最大最小值 | max(x, y, z, …, n) | Math.max(1,2,3) | 3 |
| min(x, y, z, …, n) | Math.min(1,2,3) | 1 | |
| 幂运算 | pow(x, y) | Math.pow(2, 3) | 8 |
| 随机数 | random() | Math.random() | 0.5548012085290275 |
abs(x) acos(x) acosh(x) asin(x) asinh(x) atan(x) atan2(y, x) atanh(x) cbrt(x) ceil(x) clz32(x) cos(x) cosh(x) exp(x) expm1(x) floor(x) fround(x) log(x) log10(x) log1p(x) log2(x) max(x, y, z, …, n) min(x, y, z, …, n) pow(x, y) random() round(x) sign(x) sin(x) sinh(x) sqrt(x) tan(x) tanh(x) trunc(x)
Number
constructor EPSILON isFinite() isInteger() isNaN() isSafeInteger() MAX_SAFE_INTEGER MIN_SAFE_INTEGER MAX_VALUE MIN_VALUE NEGATIVE_INFINITY NaN POSITIVE_INFINITY prototype toExponential(x) toFixed(x) toLocaleString() toPrecision(x) toString() valueOf()
RegExp
exec() test()
String
charAt() charCodeAt() codePointAt() concat() endsWith() fromCharCode() includes() indexOf() lastIndexOf() length localeCompare() match() prototype repeat() replace() search() slice() split() startsWith() substr() substring() toLocaleLowerCase() toLocaleUpperCase() toLowerCase() toString() toUpperCase() trim() trimEnd() trimStart() valueOf()
codePointAt() includes() startsWith() endsWith() repeat() padStart() padEnd() trim()
对象
constructor prototype
Object.is() Object.assign() Object.keys() Object.values() Object.entries() toString() valueOf()
运算符
语句
| 方法 | |
|---|---|
| 变量、常量 | var let const |
| 条件语句 | if … else |
| for循环语句 | for |
| for … in | |
| for … of | |
| while循环语句 | while |
| do … while | |
| 返回、终止 | break continue return |
| Switch 语句 | switch |
| 异常 | throw |
| try … catch … finally | |
| 调试 | debugger |
| 类 | class |
| 函数 | function |
这篇博客详细介绍了JavaScript的基础知识,包括Array、Boolean、Class、Date等核心概念,涵盖Error、Global、JSON、Math、Number、RegExp、String等多个方面,以及对象、运算符、语句和类型化数组的相关操作。无论是初学者还是经验丰富的开发者,都能从中找到有价值的内容。
9647

被折叠的 条评论
为什么被折叠?



