FAQ
General
JavaScript
var name=function(){}vs.function name(){}This question has been asked many times and discussed in great detail in the forums. Please read the answers to these questions:
The
newkeywordRead the OOP section of the JavaScript Glossary on Codecademy. The use of the
newkeyword is explained under "Class Instances and Usage".For more details, read this answer on StackOverflow or this definition in the Mozilla wiki.
Chained comparison statement:
a < b < cJavaScript translates
a < b < cto(a < b) < c. The first parentheses will yieldtrueif and only ifais less thanb, but thentrueis compared toc. In that situation,trueevaluates to 1, so ifcis larger than 1, the whole thing returnstrue, but this, of course, doesn't mean thatbwas actually betweenaandc.
Web
Classes vs. IDs: See this answer. For more details, read this excellent CSSTricks article.
Bold, Italic, Emphasis:
<b>,<i>vs.<em>,<strong>: read my answer and mtf’s answer.
Ruby
Value Assignment and
x += 1– with pictures!. This answer isn’t Ruby-specific. It applies to pretty much every programming language.
Python
jQuery
Changing box size on mouseover using jQuery vs. CSS3