this = {};
ReferenceError: Invalid left-hand side in assignment;
But of course you can make sure 'this' is something you expect it to be. if(!this.tagName){
throw new Error("Only DOM objects can used as 'this'")
}903 karma · joined September 10, 2011
this = {};
ReferenceError: Invalid left-hand side in assignment;
But of course you can make sure 'this' is something you expect it to be. if(!this.tagName){
throw new Error("Only DOM objects can used as 'this'")
} var player = {
play: function(){
var self = this;
setTimeout(function(){
console.log(self);
});
}
} Function.prototype.call(this, argument0, argument1...)
Function.prototype.apply(this, [arguments]) // array for args.
In a related note I created a variation of .bind that can have its bounded arguments an 'this' overwritten called mixbind, and also the methods .mixcall and .mixapply that can be used to overwrite arguments too (you can use NULL or undefined to left holes):
https://gist.github.com/4303394There is many widely different definitions of what a mass-shooting is (about apples we don't); the article is using a definition from the motherjones website; their definition is strict but randomly chosen; like somebody claiming that only red apples are real apples and the other ones are not; with no data to support that this definition creates any useful subset that can or should be statistically analysed; the statistical sample is already biased by absolutist and arbitrary boolean conditionals which render null any conclusion extracted from its statistical analysis (e.g shooter killed 3 people instead of 4 and therefore is not a mass-shooter)
function doAsyncCall(callback){
var error, result;
// .. do some async stuff
// assign error if there was one or result when everything went fine
if( !error ){ result = data; }
callback(error, result);
}This kinds of countermeasures generalizations based on single incidents always struck me as rather silly.