JavaScript Constructor Functions




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


16 responses to “JavaScript Constructor Functions”

  1. 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.

  2. 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 Reply