Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

bind() method

var car = {
    registrationNumber: "FT5142",
    brand: "Benz",

    displayDetails: function(){
        console.log(this.registrationNumber+ " " + this.brand );
    }
}
car.displayDetails();


var myCarDetails = car.displayDetails.bind(car);
myCarDetails();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #method
ADD COMMENT
Topic
Name
4+1 =