1.原始类型
number string boolean underfined null
js
‘’’
console.log(123, typeof 123);
console.log(“php”, typeof “php”);
console.log(true, typeof true);
console.log(undefined, typeof undefined);
console.log(null, typeof null);
‘’’
2.引用类型
array object function
2.1 array
js
‘’’
const arr = [“手机”, 2, 5000];
console.log(arr);
console.log(arr[0]);
console.log(arr[1]);
console.log(arr[2]);
console.log(typeof arr);
console.log(Array.isArray(arr));
‘’’
2.2 object
js
‘’’
console.log(123, typeof 123);
console.log(“php”, typeof “php”);
console.log(true, typeof true);
console.log(undefined, typeof undefined);
console.log(null, typeof null);
‘’’
2.3 function
2.3.1 value
js
‘’’
function f2() {
let a = 1;
return function () {
return a++;
};
}
console.log(f2());
const f = f2();
console.log(f());
console.log(f());
console.log(f());
console.log(f());
console.log(f());
console.log(f());
‘’’
2.3.2 object
js
‘’’
function f1(callback) {
console.log(callback());
}
f1(function () {
return “hell 朱老师”;
});
‘’’