Coder Social home page Coder Social logo

Comments (5)

rottenpen avatar rottenpen commented on June 12, 2024

什么是原型链

JavaScript 常被描述为一种基于原型的语言 (prototype-based language)——每个对象拥有一个原型对象,对象以其原型为模板、从原型继承方法和属性。原型对象也可能拥有原型,并从中继承方法和属性,一层一层、以此类推。这种关系常被称为原型链 (prototype chain),它解释了为何一个对象会拥有定义在其他对象中的属性和方法。
上面这段话来字 MDN。
画一下重点:每个对象拥有一个原型对象,以其为原型,原型对象也可能拥有原型,并继承其方法与属性,这就构成了原型链。
是不是简单明了了。感觉比网上很多什么指向 prototype 的靠谱多了。

from blog.

rottenpen avatar rottenpen commented on June 12, 2024

什么是作用域

当前的执行上下文。

from blog.

rottenpen avatar rottenpen commented on June 12, 2024

vue 的生命周期

from blog.

rottenpen avatar rottenpen commented on June 12, 2024

vue 的响应式原理

主要是通过定义两个函数实现的,一个是通知更新的 cb 函数,一个是由 Object.defineReactive 实现的 defineReactive 函数。遍历所有 data 通过 defineReactive 函数实现定义 datagettersetter。当 setter 检测到数值发生变化的时候,调用 cb 函数通知更新,就实现了响应式。

纠正一下:
observe 遍历的不是 data,是 vue 对象的 option

from blog.

rottenpen avatar rottenpen commented on June 12, 2024

什么是闭包

闭包就是能够读取其他函数内部变量的函数。

from blog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.