r/javascript • • Mar 27 '15

Airbnb JavaScript Style Guide - A mostly reasonable approach to JavaScript

https://github.com/airbnb/javascript/blob/master/README.md
315 Upvotes

158 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Mar 27 '15

[deleted]

1

u/wdpttt Mar 27 '15

a function can be stored in a variable... so how would you name it? Ok, camelcase. What if it can be a function or false? Still camelcase? Ok. What about a value that can be false or true? Now breaks

0

u/[deleted] Mar 27 '15

[deleted]

1

u/eridal Mar 27 '15

A function is a function. Anything else is not a function.

be aware that what you get may not be what you were expecting...

function test(fn) {
   fn.call(null, 1, 2, 3);
}

var log = function() {
  console.log (arguments)
};

test(log);  // a _real_ function
test({call: log}) // a duck object

0

u/[deleted] Mar 27 '15

[deleted]

→ More replies (0)