Skip to content
New issue

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

JS原型,继承,new和instanceof的实现 | Davis #25

Open
lvzero535 opened this issue Mar 6, 2021 · 0 comments
Open

JS原型,继承,new和instanceof的实现 | Davis #25

lvzero535 opened this issue Mar 6, 2021 · 0 comments

Comments

@lvzero535
Copy link
Owner

https://lvdongfeng.vip/2021/03/07/JS%E5%8E%9F%E5%9E%8B%EF%BC%8C%E7%BB%A7%E6%89%BF%EF%BC%8Cnew%E5%92%8Cinstanceof%E7%9A%84%E5%AE%9E%E7%8E%B0/#more

原型JS里万物皆对象,而对象是由构造函数创建的。基本数据类型都有与之对应的构造函数。如number 对应的是Number,当你定义一个变量并存储一种数据类型时(变量没有类型,数据有类型),会有相应的数据类型的方法,这些方法从哪里来?其实就是从原型来的。 1234567var a = 1; // 定义一个数字型// a 是基本数据类型,基本数据类型是没有方法的,方法只有对象才有。哪这里为a为啥可以调

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant