JavaScript Basics / PDF


JavaScript Basics / PDF


JavaScript Basics / PDF






Sample of the PDF document 






• At this point, you should have reached a certain comfort level with typing and running JavaScript code
— assuming, of course, that someone has already written it for you
• This handout aims to summarize some basic building blocks that will get you on the road to writing some of
your own JavaScript programs
• If you’re interested more details, either consult me, the recommended textbook, or the web — whatever you feel will work best for you :)


The Big Picture
• JavaScript (and many other programming languages) have the following basic building blocks (there are more, of course — but this is what we have for now):

Expressions!!!!!!!!!!Variables!!!!!!!!!!Statements

• Of these building blocks, the statement is the construct that plays the closest role to a plain English instruction — a JavaScript program is essentially a sequence of statements, each of which may involve one or more expressions or variables to get its work done


Expressions
• Expressions are the fundamental “things” or “nouns” in JavaScript — they are pieces of code that are evaluated to determine the “thing” that this code represents
• Examples of such expressions (and their corresponding “things” or computed values) include:
• Expressions consist of values and operators
• Every value in JavaScript is either a Boolean (true or false), a number, a string (i.e., a piece of text, including letters, numbers, punctuation, or other symbols), a special value called undefined, a special value called null, or an object
• Of these, Booleans, numbers, and strings are easiest values to understand, because we probably already use them a lot in daily life
• Operators represent actions that combine or manipulate values to produce a new value — for example,
multiplication operator (represented by * in JavaScript) combines two numbers and to compute their product

Strings

• Values that we typically think of as text, words, or phrases fall under the technical term string — symbols
(or characters) that are strung together
• The notion of a “symbol” here is actually quite broad: it adheres to a standard called Unicode and encompasses way more than the alphabet, numbers, and punctuation
• String values are written within double quotes (e.g., "string") or single quotes (e.g., 'string'), all on one line
• Special symbols are preceded by a backslash (\) — ask me if you’re curious about these...........






Download JavaScript Basics / PDF








JavaScript Basics / PDF





0 commentaires: