Object Car / js /

by asdf

JavaScript

//Object, Number, String, null, undefined, Boolean
//Function

function Car() {
    var wheel = 4;
    this.color = 'red';
    this.bla = Car.bla;        
    this.getWheel = function() {
        return wheel;
    };
    
    return this;
}

var b = {
    wheel: 4,
    color: 'red'
};

//Car.bla = 5;
//Car.prototype
//Car['bla'] = 15;
//console.log(Car['bla']);

Car.prototype.drive = function() {
    console.log('driving');
}
    
var honda = new Car();
// honda = new Car() ->
// 1. honda = new Object()
// 2. honda.[[Prototype]] = Car.prototype
// 3. Car.call(honda) <- honda.color = "red"

Car.bla = 5;
console.log(honda.bla);
if(typeof honda.bla == 'undefined'){
}
var x = new Number(5);
x.test = 10;
console.log(x.test);