Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

bind() method #1

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

    displayDetails: function(ownerName){
        console.log(ownerName + ", this is your car: " + this.registrationNumber+ " " + this.brand );
    }
}
// car.displayDetails();


var myCarDetails = car.displayDetails.bind(car, "Raymund");
myCarDetails();
Source by www.interviewbit.com #
 
PREVIOUS NEXT
Tagged: #method
ADD COMMENT
Topic
Name
4+2 =