JavaScript is an Object Oriented Programming (OOP) language. A programming language can be called object-oriented if it provides four basic capabilities to …

source

21 COMMENTS

  1. sir not getting any output in second method of object creation.
    function Cars(car_brand,car_model,price)
    {
    this.car_brand=car_brand;
    this.car_model=car_model;
    this.price=price;
    this.teslaAutoPilot() = function()
    {
    document.write("<h2>This car has Auto pilot</h2>");

    }
    }
    var c1= new Cars("Tesla","model 3",35000);
    var c2 = new Cars("Tesla","Model P",45000);
    c1.teslaAutoPilot();
    document.write("<h3>"+c2.car_model+"</h3>");

    help me to find error

  2. its been 4 years i was wondering to understand the this concept.but always end up finding it complex to understand but today you made it super simple to understand thank you soooooo much 🙂

  3. i have question ,we declare function like, function info(){} but ,here is declare function into object like teslaAutopilot : function() , i don't understand, please can you tell me ,why declare first function name?

  4. Here, you should of explain with multiple examples, we want to access not only one brand we still have few more brands also different models, then we should of understand how to access only one brand details where there are multiple brands. kindly extend here if possible.

  5. Function cars(brand,year){
    this.brand = brand; this.year =year;
    this.carfunction(){
    document.write("<p>"+cars.brand+"</p>;
    }}
    Var C2 = new cars("Tesla",2019);
    C2.carfunction();

    Am not getting the value of cars.brand value printed.please help me why

LEAVE A REPLY

Please enter your comment!
Please enter your name here