JavaScript underscore and 'this' keyword


#1

Many underscore functions, such as each and map take a third argument context. By default, it is some value different from the caller’s context this, which causes problems in Jasmine tests. You can get around this by calling, e.g.,

_.each(list, function(e) {... your this here ...}, this);