We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
两种数据类型的存储位置不同
console.log(typeof 2); // number console.log(typeof true); // boolean console.log(typeof 'str'); // string console.log(typeof []); // object console.log(typeof function(){}); // function console.log(typeof {}); // object console.log(typeof undefined); // undefined console.log(typeof null); // object
console.log(2 instanceof Number); // false console.log(true instanceof Boolean); // false console.log('str' instanceof String); // false console.log([] instanceof Array); // true console.log(function(){} instanceof Function); // true console.log({} instanceof Object); // true
注意 :instanceof 只能正确判断引用数据类型
The text was updated successfully, but these errors were encountered:
No branches or pull requests
堆和栈
两种数据类型的存储位置不同
占据空间小,大小固定
占据空间大,大小不固定
数据类型判断
typeof 是一个运算符,能够返回数据类型
instanceof 可以正确判断对象的类型,其内部运行机制是判断在其原型链中能否找到该类型的原型
注意 :instanceof 只能正确判断引用数据类型
The text was updated successfully, but these errors were encountered: