数值

声明用var
遍历数组: for…in …
方法: Array.isArray(),push(),unshift(),pop(),shift(),join(),concate(),reverse(),indexof()

函数

声明:
function print(s){
console.log(s);
}
注意:即使先写掉用的代码,在写声明函数,最后执行的时候,声明会被提升到代码的头部

对象

键值可以是任何数据类型
var user = {
name : “hello”,
getname:function(){
console.log(“world”)
}
container:{
frondEnd:”前端”,
backEnd:”后端”
}
}
链式掉用console.log(user.container.frondEnd)

Math 对象

Math.abs(),Math.max(),Math.min(),Math.floor(),Math.cell(),Math.random()

Date对象

Date.now(),
一系列Get方法:get.Date(),get.Time(),get.Day(),get.Year()等方法
疑问点:为啥Math可以直接掉用方法,而Date需要声明一个实例才能掉用方法。

作者:simin  创建时间:2025-11-01 17:10
最后编辑:simin  更新时间:2025-11-01 17:26