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
typeof 1 === 'number' // true typeof Number(1) === 'number' // true typeof new Number(1) === 'object' // true 1 instanceof Number === false // true Number(1) instanceof Number === false // true new Number(1) instanceof Number === true // true 1 instanceof Object === false // true Number(1) instanceof Object === false // true new Number(1) instanceof Object === true // true Object.prototype.toString.call(1) === '[object Number]' // true Object.prototype.toString.call(Number(1)) === '[object Number]' // true Object.prototype.toString.call(new Number(1)) === '[object Number]' // true
为什么赋值了基本类型的变量能够调用方法?
读取变量时会创建基本包装类型,通过基本包装类型来调用对应的方法。
基本包装类型和引用类型的区别
生命周期的不同,基本包装类型在创建完调用方法后就会立即销毁。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
区别
读取变量时会创建基本包装类型,通过基本包装类型来调用对应的方法。
生命周期的不同,基本包装类型在创建完调用方法后就会立即销毁。
The text was updated successfully, but these errors were encountered: