Blogger Information
Blog 31
fans 0
comment 0
visits 14266
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
函数类型和数据类型
木子木杉
Original
593 people have browsed it

函数类型

数据类型

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 朱老师”;
});
‘’’

Correcting teacher:PHPzPHPz

Correction status:unqualified

Teacher's comments:不是‘’’,而是```,三个反引号
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post