Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Madelene Campos
    @Madelene
    Thank you!
    Alexis Abril
    @alexisabril
    thanks everyone for attending!
    John Hitz
    @johnhitz
    Thanks! This is a really great resource!
    OlgaMaraeva
    @OlgaMaraeva
    Thank you!
    OlgaMaraeva
    @OlgaMaraeva
    Maybe i didn't understand the goal of test. http://jsfiddle.net/2ghhrzf4/3/ I need just to call person constructor or set it in NEW constructor? playing whole day but understood nothing:)
    Alexis Abril
    @alexisabril
    @OlgaMaraeva You’re actually pretty close in that example
    you don’t need object.create, but I like where your head’s at

    This line here:

    constructor.applay(ist, Array.prototype.slice.call(arguments, 1)

    Typo in apply ;)

    You do need to invoke the constructor and this line is actually correct, but you can do less. Think about what apply() expects as arguments and what you have available to you.

    OlgaMaraeva
    @OlgaMaraeva
    Oh, thank you a lot @alexisabril! I checked so much but didn't think about mistake in method letters)))) continue thinking
    OlgaMaraeva
    @OlgaMaraeva
    "person is not defined". Can't understand where i lost new http://jsfiddle.net/2ghhrzf4/7/
    Anikeychik Dmitry
    @dima716

    @OlgaMaraeva you forgot to create a Person function constructor that’s why it says «Person is undefined»

    I also corrected a line where you use prototype property for object. You should use instead proto property if you want to set its prototype.

    You can see it here: http://jsfiddle.net/0tLsn27x/1/

    OlgaMaraeva
    @OlgaMaraeva
    @dima716 thank you! I was thinking that i do not need to write person constructor, because of NEW api can do it automatically. If not, why we need the NEW function? Can we simply write the Person function and var smth = new Person('Justin'); to create the class? And i can i also ask for proto property. MDN says that its deprecated. Can i use ist.prototype = Object. create(constructor.prototype) as MDN recommended?
    Anikeychik Dmitry
    @dima716

    @OlgaMaraeva you’re welcome:) About person constructor. It’s not NEW’s responsibility to create a function constructor. When you use NEW or even original new keyword, function constructor had to be created before you use it with new.

    Just try this code var obj = new Person() in console.
    This code won’t work because Person isn’t defined. The same thing with our NEW function.
    Thus, you should manually create function constructor and then use it with NEW or original new keyword.

    Example:

    function Person(name){this.name = name}
    
    var justin = new Person('Justin')
    var david = NEW(Person,['David'])

    About proto property. You’re absolutely right. It’s deprecated and ist.prototype = Object. create(constructor.prototype) is a better option.

    I used proto property just to emphasize that proto and prototype are completly different things.

    OlgaMaraeva
    @OlgaMaraeva
    @dima716 Thank you a lot for this post! I see that NEW function maybe added here to apply properties from constructor. +1 Very good explanation, indeed.
    Justin Meyer
    @justinbmeyer
    @OlgaMaraeva @dima716 Using Object.create or Object.setPrototype is better in code you are writing for an actual application or library
    however, for this example, I think proto is better because I want people to realize that proto is just a "normal" property
    it's only that the DOT(.) and NEW(new) operators treat it differently
    otherwise, setting thing.__proto__ would just be like doing thing.foo
    OlgaMaraeva
    @OlgaMaraeva
    @justinbmeyer Thank you very much for explanation! It's very helpful example. I was confusing because of goal of NEW function. But now i see that it good way to set call or apply methods for inherit properties. Its the main reason we wrote this function instead of simply set var smth = new Person(); Hope i understand well.
    Alexis Abril
    @alexisabril
    hey everyone, we’ll be live momentarily
    Alexis Abril
    @alexisabril
    for following along with justin’s answers: http://jsbin.com/lomipujelu/latest/watch?js,output
    Alexis Abril
    @alexisabril
    for following along with today’s exercise answers(jquery utilities): http://jsbin.com/javacayewo/latest/watch?js,output
    Madelene Campos
    @Madelene
    woohooo!
    Madelene Campos
    @Madelene
    btw, the creator of jQuery was on the Codenewbie podcast a few weeks ago: http://www.codenewbie.org/podcast/creating-jquery (just saying)
    Zurc
    @Zurc
    I'm totally lost this time guys. Better I look all your videos again to try to catch up your pace...
    Madelene Campos
    @Madelene
    it’s ok..something is sticking.. :)
    Zurc
    @Zurc
    I'm trying to check back on the video, but it is completely blurred so I can not watch the code to tell you where I'm lost... :(
    Madelene Campos
    @Madelene
    ok stupid question. Is “number” an actual number, or a string?
    right..because it’s measuring something (length)
    Madelene Campos
    @Madelene
    regardless of what the property is?
    null, etc?
    yes
    number, string, etc?
    ah ok
    right
    yes
    ok…so can you review what you just did?
    (why you did it)
    (nevermind..keep going) :D
    Zurc
    @Zurc
    is it possible to update the jsbin so we can see your code instead of going back on the video?
    Zurc
    @Zurc
    yes! thanks
    Anikeychik Dmitry
    @dima716
    Is it the same as bind function ?
    Madelene Campos
    @Madelene
    thank you guys!
    Zurc
    @Zurc
    thank you!
    Anikeychik Dmitry
    @dima716
    Thanks guys!
    Eric Gould
    @surface2air
    Thanks! Have a great week!
    Alexis Abril
    @alexisabril
    thanks everyone for joining us!
    Justin Meyer
    @justinbmeyer
    going to start in a little bit