function Person(name) {
this.name = name;
}
Person.prototype.myFriends5 = function(friends) {
var arr = friends.map(function(el) {
return this.name + ' is friends with ' + el;
}.bind(this));
console.log(arr);
}
var friends = ['Bob', 'Jane', 'Mark']
new Person('John').myFriends5(friends);
Hi, I am having a problem to understand how 'this' keyword works in bind method. So the result of the code above is this "John is friends with Bob","John is friends with Jane","John is friends with Mark". But without .bind(this), the result comes out like this " is friends with Bob"," is friends with Jane"," is friends with Mark". What is the difference with and without .bind(this) in this code?