MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/30hyan/airbnb_javascript_style_guide_a_mostly_reasonable/cpspvhe/?context=3
r/javascript • u/mrkipling • Mar 27 '15
158 comments sorted by
View all comments
Show parent comments
0
[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)
1
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)
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)
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)
→ More replies (0)
0
u/[deleted] Mar 27 '15
[deleted]