28-06-2013, 02:33 PM
Essential Javascript -- A Javascript Tutorial
Essential Javascript.pdf (Size: 234.06 KB / Downloads: 33)
INTRODUCTION
Javascript is an interpreted language with a C like syntax. While many people brush the language
off as nothing more than a browser scripting language, it actually supports many advanced
concepts such as object-oriented-programing, recursion, lambda, and closures. It's a very
approachable language for the beginner that quickly scales to be as powerful a tool as your skills
allow.
This reference will cover the basic language constructs. This is not a beginner's guide to
programming. This article focuses on bringing people who already know another programming
language up to speed on Javascript methodology. Additionally, this is not an exhaustive language
definition, it is a broad overview that will occasionally focus in on some more advanced
concepts. It's here to get you started, other articles will focus on making you an expert.
Javascript is case sensitive.
It should also be noted, before we begin, that Javascript is extremely case sensitive so if you're
trying to code along with any examples make sure lowercase is lowercase and uppercase is
uppercase. For the most part Javascript is also a camel-cased language. That is, if you're trying to
express more than one word you will eliminate the spaces, leave the first letter uncapitalized
and capitalize the first letter of each word. Thus "get element by id" becomes "getElementByID".
Javascript is an Event Driven Language
As you can tell from the input examples, Javascript is an event driven language which means
your scripts react to events you set up. Your code isn't running all the time, it simply waits until
an event starts something up! Going into all the Javascript events is beyond the scope of this
document but here's a short-list of common events to get you started.
Variable Scope
Variables in Javascript have FUNCTION scope. That is, all variables are global unless they are
explicitly defined inside a function and even then child-functions have access to their parent's
variables. If a function defines a new variable WITHOUT using the var keyword, that variable will
be global in scope.