I am trying to understand .bind and made the following code:
a simply object:
person = {
name:\"Joe\",
surname:\"Something\",
tool:\"gun
This has nothing to do with bind
.
When you call newPolice()
it logs the result of this:
console.log("You are under arrest, " + this.name + " " + this.surname);
When you call console.log( newPolice() );
, you now have two console.log
statements which, between them, log:
newPolice
newPolice
doesn't have a return
statement, so it returns undefined
.