A language supports first class functions if:
//this is an object
var myObject = {};
//you can add properties(values) and methods(functions) to an object
myObject.name = 'Sam Object';
myObject.whatIsMyName = function() {
return this.name;
}
//That's it.
What's wrong with this Object?
I can't reuse it or make multiple copies of it.
http://stackoverflow.com/questions/17525450/object-vs-class-vs-function
if (!Array.prototype.forEach) {
Array.prototype.forEach = function(callback, context) {
for (var i = 0; i < this.length; i++) {
callback.call(context || null, this[i], i, this);
}
};
}
function User(first, last) {
if (!(this instanceof arguments.callee)) {
return new User(first,last);
}
this.name = first + " " + last;
}