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
new
keywordRead the OOP section of the JavaScript Glossary on Codecademy. The use of the
new
keyword 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 < c
JavaScript translates
a < b < c
to(a < b) < c
. The first parentheses will yieldtrue
if and only ifa
is less thanb
, but thentrue
is compared toc
. In that situation,true
evaluates to 1, so ifc
is larger than 1, the whole thing returnstrue
, but this, of course, doesn't mean thatb
was actually betweena
andc
.
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