2 years ago I starded learning AS3 in order to get hired at a web design company. A few months later, I ditched it, because I discovered that I'm better at design; so now I'm a web designer.

Recently, I decided that knowing JavaScript would be nice and helpful, so i started with Essential JavaScript Training from Lynda.com. Untill today, I was under the impression that my knowledge of programming was somewhat basic. What happened today...? I learned (through trial and error) that variables are only valid in the functions that they're defined in. This turned my world upside down. I was like: "that makes sense now..." thinkin of the all the headaches that the lack of this specific piece of knowledge gave me. How could I have missed such a fundamental thing while learning AS3 (and now JS)? I didn't. And I remember reading a at least three books on AS3, but none of them taught me about programming.

So what I want to ask you, is if you could recommend me a good JavaScript book from which i can learn programming, too, besides syntax.

Thanks! And sorry for my bad english :)

  • 5
    Three books and they never explained as fundamental a concept as variable scope?!? Do you remember which books they were so we'll know what to avoid? :P Commented Oct 19, 2010 at 23:37
  • No, sorry. But I always choose books based on reviews, so they must've been pretty good :)
    – darwyn4
    Commented Oct 19, 2010 at 23:41
  • Sounds like Essential Javascript Training didn't teach you the essentials. In Javascript, if you forget to use var you will create a variable with global scope, even if it's inside a function. Commented Nov 10, 2010 at 0:38
  • @kirk - I think you misunderstood @darwyn4. She said she learned about scope after recently starting JET — it was the ActionScript books that didn't mention the topic. And if you look at my answer below, you'll see that I mentioned where in JET I covered the topic.
    – Dori
    Commented Dec 7, 2010 at 0:05

3 Answers 3


As the author of Lynda.com's JavaScript Essential Training, I feel like I kind of have to jump in here…

IIRC, I covered variables and global versus local scope in Example 4 of Lesson 4 ("Creating prompts for users") when I first talked about var. If I wasn't clear enough, I apologize!

If you're looking for a solid beginner-level JavaScript book, may I suggest JavaScript & Ajax for the Web: Visual QuickStart Guide, 7th edition? Yes, I'm the co-author (with Tom Negrino), but I've received a lot of compliments on it from people who had never previously written code—they said that other books just confused them, and ours was the first that didn't assume they were already programmers.

Here's what it says on page 36:

Using var does two things:

  • It tells JavaScript to create a variable (that is, to set aside some space in memory for this new object).
  • It defines the scope of the variable, that is, where JavaScript needs to know about this particular object (see the What Is Scope? sidebar). If a variable is created inside a function, other functions don’t have access to it, as it’s local to that function. If it’s created outside any function, it’s global, and everything has access to it. In this script, we’re creating the ans global variable.

You said your previous books were on AS, so hopefully JS&A:VQS wasn't one of the books you had trouble with…

And if you have any further questions about particular bits of JavaScript code, StackOverflow is probably the place for them.

Edited to add…

Just my 2¢: I suggest that you—for now—ignore the Douglas Crockford recommendations. Yes, he does know his stuff (although I disagree with some of what he says, and I suspect he disagrees with 90% of how/what I teach) -- but I cannot honestly recommend his work for someone who doesn't have solid programming experience. His stuff is for intermediate/advanced-level scripters, not for someone at your current stage.

  • 1
    Thank you for taking the time to write me an answer. I will try and get the book. I hope it's as easy to understand as the Lynda tutorial.
    – darwyn4
    Commented Oct 20, 2010 at 14:47
  • Given that they're both my babies and I shouldn't play favorites… I think that they're equally understandable. It mostly depends on what kind of learner you are.
    – Dori
    Commented Oct 21, 2010 at 4:06

I'd recommend a few links all located at: http://javascript.crockford.com/

The problem with JavaScript is there is a lot of really bad advice out there, the link above may be a bit of a rant from the author but he knows what he is doing.

JavaScript can be a horrible thing to write and maintain or something very easy and fluid. The choice is in how you use it.

http://javascript.crockford.com/code.html for conventions.

  • 2
    +1 for Crockford. That guy is great. Sadly, the "Javascript: The Good Parts" is just for someone who have a good base at programming.
    – JulioC
    Commented Oct 21, 2010 at 5:19

Video Tutor : Douglas Crockford: "The JavaScript Programming Language"(4 videos)

Though Crockford can confuse you initially, he can get basic concepts straight in JavaScript.

Text Tutor : A very detailed tutor available on Mozilla Development Center on Javascript

Not the answer you're looking for? Browse other questions tagged or ask your own question.