openexchangerates / javascript-sandbox-console

a mini interactive javascript console for library/plugin demos and homepages
http://openexchangerates.github.io/javascript-sandbox-console/
MIT License
319 stars 58 forks source link

_([16,17,18]).indexOf oddity in Chrome on Ubuntu #14

Open JogoShugh opened 9 years ago

JogoShugh commented 9 years ago

I'm not sure why there is an _ in this line:

https://github.com/openexchangerates/javascript-sandbox-console/blob/master/src/sandbox-console.js#L286

if ( _([16,17,18]).indexOf(e.which, true) > -1 ) this.ctrl = true;

I was having trouble in Chrome under Ubuntu until I removed the _. It kept setting this.ctrl to true.

All that underscore's _ function does is this:

var _ = function(obj) {
    if (obj instanceof _) return obj;
    if (!(this instanceof _)) return new _(obj);
    this._wrapped = obj;
  };

But, I don't understand what is beneficial about doing that for this line?