MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/30hyan/airbnb_javascript_style_guide_a_mostly_reasonable/cpsudh5/?context=3
r/javascript • u/mrkipling • Mar 27 '15
158 comments sorted by
View all comments
Show parent comments
3
How about String(totalScore) or totalScore.toFixed()?
String(totalScore)
totalScore.toFixed()
Say what you mean; explicit is better than implicit.
1 u/wreckedadvent Yavascript Mar 27 '15 Well, one could arguably be explicit about things like new Object() as well, but this is not usually considered idiomatic javascript. 3 u/theillustratedlife Mar 27 '15 Adding an empty string instead of calling the method that's whole purpose is to return the value cast to a string is idiomatic JavaScript? 1 u/wreckedadvent Yavascript Mar 27 '15 Arguably! Hence why it's in the style guide. :)
1
Well, one could arguably be explicit about things like new Object() as well, but this is not usually considered idiomatic javascript.
new Object()
3 u/theillustratedlife Mar 27 '15 Adding an empty string instead of calling the method that's whole purpose is to return the value cast to a string is idiomatic JavaScript? 1 u/wreckedadvent Yavascript Mar 27 '15 Arguably! Hence why it's in the style guide. :)
Adding an empty string instead of calling the method that's whole purpose is to return the value cast to a string is idiomatic JavaScript?
1 u/wreckedadvent Yavascript Mar 27 '15 Arguably! Hence why it's in the style guide. :)
Arguably! Hence why it's in the style guide. :)
3
u/theillustratedlife Mar 27 '15
How about
String(totalScore)ortotalScore.toFixed()?Say what you mean; explicit is better than implicit.