The problem with the context binding: I can not figure out how to bind to this.title - displays undefined .
function bind(func, context) { return function() { return func.apply(context, arguments); }; } var group = { title: "Наш курс", students: ["Вася", "Петя", "Даша"], showList: function(){ this.students.forEach(function(student) { alert(this.title + ': ' + student); }) } }; var hi = bind(group.showList, group); hi();
this.students.forEach(function() {/* */}.bind(this));not? - Dmitriy Simushev