• Saturday , 30 May 2020

JavaScript Constructor Functions

Code Canyon



JavaScript Constructor Functions made simple.

🔥Get the COMPLETE course (83% OFF – LIMITED TIME ONLY): http://bit.ly/2M1sp4B

Subscribe for more videos:
https://www.youtube.com/channel/UCWv7vMbMWH4-V0ZXdmDpPBA?sub_confirmation=1

Want to learn more from me? Check out my blog and courses:

http://programmingwithmosh.com
https://www.facebook.com/programmingwithmosh/


Original source

3d Ocean

Related Posts

16 Comments

  1. Arshad Hussain
    May 11, 2019 at 17:45

    God gifted mind to Mosh

  2. TheCarFactor
    May 11, 2019 at 17:45

    Bro…you rock! Great tutorials man, thumbs up on all of them. Of course I subscribed :-))

  3. Naga Krushna Yelisetty
    May 11, 2019 at 17:45

    You are genious, explaning each piece of code in clear manner!

  4. Abik Jung Gurung
    May 11, 2019 at 17:45

    Thank you!!

  5. Arn Nilo Vicente Mesa
    May 11, 2019 at 17:45

    Wow javascript programmers are retarded when it comes to indentation.

  6. Thomas Coffey
    May 11, 2019 at 17:45

    Running the code and showing output in the console would be helpful

  7. kaos092
    May 11, 2019 at 17:45

    The only thing I don't understand is setting this.radius = radius. What is the purpose? It's saying object.parameter = parameter

  8. solmaz K
    May 11, 2019 at 17:45

    I prefer factory functions

  9. Mir
    May 11, 2019 at 17:45

    Constructor function looks unnecessarily complicated. Factory function is quite simple.

  10. Srinivasan Amarnathan
    May 11, 2019 at 17:45

    Mosh … Why you are not in Udemy …

  11. Son Of Troy
    May 11, 2019 at 17:45

    Nice js talk! I’m learning something new everyday… thanks

  12. jsprodev
    May 11, 2019 at 17:45

    The new keyword also sets the prototype of the object to its parent which is Circle
    e.g Object.setPrototypeOf(newlyCreatedObject, ConstructorFunction)

  13. Mert Mertoglu
    May 11, 2019 at 17:45

    Ok well. Which one is faster? I think Factory Functions are faster and Constructor Functions are spending more performance.

  14. Vicente Mata
    May 11, 2019 at 17:45

    And what about ES6's classes? What's the difference between this way of creating objects and classes?

  15. Fredo Corleone
    May 11, 2019 at 17:45

    Mosh explanation is always very neat and good.

    My 2 cents about this topic:
    Factory functions are a more reliable way to make objects.

    Objects created via constructor have binding problem, those objects simply lose their scope in some occasion.

    JavaScript is a functional programming language natively, not an object oriented one.

    Messing with prototypes can have a bad impact in terms of performance.

  16. Andrew Diz
    May 11, 2019 at 17:45

    Why not include the new ES6 notation with class and constructor?
    The code would read something like:
    class Circle {
    constructor(radius){
    this.radius = radius;
    }
    draw() {
    console.log('draw')
    }
    }
    const myCircle = new Circle(radius)

Leave A Comment

You must be logged in to post a comment.