Code Monkey home page Code Monkey logo

Comments (4)

lessfish avatar lessfish commented on June 5, 2024

@zhoucumt
看个例子:

function Person(obj) {
  if (obj instanceof Person)
    return obj;

  if (!(this instanceof Person))
    return new Person(obj);

  this.name = obj;
}

var p = Person('hanzichi');
console.log(p);

试着把 this 改成 obj 看看, this.name = obj 这行永远也调不到

from underscore-analysis.

zhoucumt avatar zhoucumt commented on June 5, 2024

@hanzichi 希望楼主能给出underscore整体上的设计原理和框架的设计思路。现在讲的都是细节的知识点,整体上没能让人很好的把握。谢谢

from underscore-analysis.

ahonn avatar ahonn commented on June 5, 2024

@zhoucumt 其实最好的方式是自己去读一遍

from underscore-analysis.

lessfish avatar lessfish commented on June 5, 2024

@zhoucumt

整体思路和设计原理,以及调用方式包括 OOP 等是肯定会讲的,只是我希望把它放在最后讲,个人觉得前者不影响对于细节方法的理解。甚至可以将 _ 简化下如此理解:

var _ = {};
_.each = function() {
  // ...
};

from underscore-analysis.

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.