News for hackers. Stuff that matters.
Re:One page: Javascript in 10 minutes by martinkallstrom on Wednesday January 26, 2011 @04:36AM (#2142747)
Although I thoroughly appreciate the intent of this introductory page, a really bad way of teaching something to the neophyte is to lead with examples of what NOT to do. If they are to appear at all the place for them is far, far down at the page when all the good examples of what to do has been understood and memorized.

Also, the author should probably put something at the top stating who the introduction is intended for. It is clear to me that it is not for newbie programmers, but that would not be clear to the actual newbie.

A beginner could very well set out thinking that this is the perfect introduction to programming for them. And then in the first paragraph discover the semantically very rich phrase "Javascript is a dynamically typed language". To a programmer that is valuable information but to the beginner it just confusing.

Re:One page: Javascript in 10 minutes by InclinedPlane on Wednesday January 26, 2011 @04:59AM (#2142784)
Don't do what Johnny Don't does. Huh?

The best method of teaching, in my experience, is to start with the fundamentals (a skeleton model at a high level of abstraction) even if it's not fully accurate and then fill in the details and all of the cautionary advice bit by bit, building up the skeleton model into a more robust and full featured model.

Re:One page: Javascript in 10 minutes by bootload on Wednesday January 26, 2011 @06:08AM (#2142895)
"... Don't do what Johnny Don't does. ..."

Love that Simpson quote, "Boy-Scoutz 'n the Hood" S5E8 ~ http://en.wikipedia.org/wiki/Boy-Scoutz_%27n_the_Hood

Re:One page: Javascript in 10 minutes by dools on Wednesday January 26, 2011 @06:26AM (#2142931)
Except it's actually "Donny Don't" :)
Re:One page: Javascript in 10 minutes by InclinedPlane on Wednesday January 26, 2011 @06:51PM (#2145865)
Re:One page: Javascript in 10 minutes by chrisbroadfoot on Wednesday January 26, 2011 @03:52AM (#2142648)

  Property Maps

  var emptyMap = {};

In JavaScript, these are called Objects. I don't think it's right for them to be called "property maps" in a tutorial like this.

The heading called "Objects" should be renamed something like "Constructors" too.

Also, using

  for (var i in array)
is not the preferred way of iterating over an array (the for construct does not guarantee ordering).
Re:One page: Javascript in 10 minutes by user24 on Wednesday January 26, 2011 @04:05AM (#2142679)
for...in loops also have the drawback of iterating over inherited properties. eg if I extended the prototype of Array with some method, then for...in would iterate over that method too.

traditional for loops incrementing until length is reached are preferable for arrays (personal style: for(var i=0,l=array.length ; i<l ; i++))

For objects, for...in with a hasOwnProperty check is preferred, I think (if you're going to be iterating over objects that is, which usually means you're using an object as a textually-indexed array, which isn't that great).

Over all a nice introduction though.

Re:One page: Javascript in 10 minutes by cema on Wednesday January 26, 2011 @08:02AM (#2143124)

  using an object as a textually-indexed array,
  which isn't that great
Using it as a hash table is just fine.
Re:One page: Javascript in 10 minutes by user24 on Wednesday January 26, 2011 @08:19AM (#2143159)
Yes, my problem was with people then wanting to iterate over said hashmap, not with using it as a hashmap in the first place. I could have worded that better, thanks.

I mean if you're going to want to iterate over it, you should probably be using an array instead.

Re:One page: Javascript in 10 minutes by BonsaiDen on Wednesday January 26, 2011 @04:57PM (#2145364)
The whole page disqualified itself instantly, not a single note about `hasOwnProperty` on the whole page :(
Re:One page: Javascript in 10 minutes by xd on Wednesday January 26, 2011 @04:36AM (#2142745)
Re:One page: Javascript in 10 minutes by rb2k_ on Wednesday January 26, 2011 @06:58AM (#2142988)
Another interesting introduction I can recommend was written by a friend of mine. It focuses more on the semantic differences to other languages (e.g. prototype based inheritance) as to the syntax:

Javascript for people who are in a hurry:

http://kaijaeger.com/javascript-for-people-who-are-in-a-hurr...

Javascript for people who are in slightly less of a a hurry:

http://kaijaeger.com/articles/javascript-for-people-who-are-...

Re:One page: Javascript in 10 minutes by andrewcooke on Thursday January 27, 2011 @01:00PM (#2148758)
The first few lines are misleading - Javascript doesn't really have an integer type. At least for Ecmascript 5 http://www.ecma-international.org/publications/files/ECMA-ST... both integers and floats are stored as IEEE floats and the type is called Number. "Small enough" integers are stored exactly so this works well enough in practice.

(Despite this, it does have some functions for converting and parsing integral values.)

Ecmascript 4 (abandoned) had some support for an Integer type (it was a kind-of pseudo-type mess where the value of a Number was checked to see if it was an integer or not).

Re:One page: Javascript in 10 minutes by everyplace on Wednesday January 26, 2011 @04:06PM (#2145136)
I teach a series of classes about the web for designers, and this is a great start. It may not be perfect, but in terms of a basic intro to express common structures to anyone with a background in any other language (for example, my students all know php) it's a good summary, and an appropriate bare-bones jumping-off-point into more specific topics.
Re:One page: Javascript in 10 minutes by lysium on Wednesday January 26, 2011 @06:09AM (#2142897)
Good intro for a programmer who just happen to not know javascript.

This propertyMap-thing for objects is scary, though.

Re:One page: Javascript in 10 minutes by atomicdog on Thursday January 27, 2011 @11:34AM (#2148416)
There's a special place in hell for people who still put opening curly brackets on the same line in 2011.