Please send questions to
st10@humboldt.edu .
Some random projections from Week 3, 8-29-06
* "legal" characters for identifiers (variable names, function
names, names you choose for things)
* 1st letter: letter, underscore, or a dollar sign $
(although considered poor style to use a $ as first char,
because code generation tools tend to use that)
* subsequent characters: any letter, digit, underscore, or $
* identifiers cannot be the same as JavaScript keywords
* now, strings --- they can contain all sorts of characters...
(a value written in double-quotes)
var name = "^$%%&^*UI%T*OT"
* what if you want a " in a string?
"\"What's up, Doc?\", said Bugs Bunny"
* \ can be used to get "special" characters
* "\n" for a newline, "\t" for a tab
* "\\" will get you a backslash character
* a few useful JavaScript functions and operators for
converting between types..
* JavaScript has:
* 3 primitive data types (number, string, and Boolean)
* 1 composite type (Object)
* 4 special values: null, undefined, NaN, Infinity
* Number(str) - that will try to convert str to a number
(it will return NaN if it can't)
parseInt(str) - will try to convert it to an integer
parseFloat(str) - will try to convert it to a floating
point value
* String(thing) - will return string version of thing
* typeof(thing) - returns a string saying what kind of thing
it is
(added after class!)
* isNaN(thing) - returns true if thing is the special value NaN