JS备忘(打印版)

这篇博客详细介绍了JavaScript的基础知识,包括Array、Boolean、Class、Date等核心概念,涵盖Error、Global、JSON、Math、Number、RegExp、String等多个方面,以及对象、运算符、语句和类型化数组的相关操作。无论是初学者还是经验丰富的开发者,都能从中找到有价值的内容。

开发板推荐:天空星STM32F407VET6开发板

超高性价比 STM32主控 | 超高主频 | 一板兼容百芯 | 比赛神器 | 沉金彩色丝印

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
类型化数组

开发板推荐:天空星STM32F407VET6开发板

超高性价比 STM32主控 | 超高主频 | 一板兼容百芯 | 比赛神器 | 沉金彩色丝印

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值