Console.log Returns An Additional Undefined
I am trying to understand .bind and made the following code: a simply object: person = { name:'Joe', surname:'Something', tool:'gun', action: function(){ c
Solution 1:
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:
- The same thing as before
- The return value of
newPolice
newPolice doesn't have a return statement, so it returns undefined.
Post a Comment for "Console.log Returns An Additional Undefined"