News for hackers. Stuff that matters.
Re:John Resig: JavaScript as a First Language by hello_moto on Wednesday December 21, 2011 @02:52PM (#3378843)
That's definitely not obvious. Some people think in patterns or generalizations.

String [binary_operator] Number = String

String [binary_operator] Number = Number

That's just begging for further explanation.

Explaining JavaScript is probably more challenging than say Java. Java has many keywords and usages, but when it comes to explaining the concept of those keywords/semantics to students, it may be a little bit less confusing.

Re:John Resig: JavaScript as a First Language by maximusprime on Wednesday December 21, 2011 @03:00PM (#3378882)
OK here's plain english simple explain...

Left hand side is a string, and "+" is string concatenation as well as addition. So '5' + 3 = '53' (String concatenation). Just as "Hello" + 1 would equal "Hello1". The right hand side is converted to a string.

Left hand side is a string, but "-" is subtraction for numbers. JS converts the '5' to a number, then subtracts. So '5' - 3 = 2 (Numerical subtraction).

That's the explanation, and it's not terribly hard to get past.

Re:John Resig: JavaScript as a First Language by barrkel on Wednesday December 21, 2011 @08:31PM (#3379926)
The issue isn't explaining it. The issue is it needing an explanation at all.