Except where otherwise noted, the contents of this document are Copyright 2012 Marty Stepp, Jessica Miller, and Victoria Kirst. All rights reserved. Any redistribution, reproduction, transmission, or storage of part or all of the contents in any form is prohibited without the author's expressed written permission.
My program does nothing.(most errors produce no output)
It just prints undefined
.
(many typos lead to undefined variables)I get an error that says, foo
has no properties.
"use strict"; your code...
"use strict";
at the very top of your JS file turns on strict syntax checking:
alert
at the top of it and make sure it appears.
Since JavaScript has no compiler, many errors will cause your JavaScript program to just "do nothing." Some questions you should ask when this happens:
alert
at the VERY TOP of your script: alert
at the start of the appropriate function: "hello"
or "here"
Object foo has no properties
ReferenceError: foo is not defined
TypeError: foo.bar is not a function
id
function foo() {
... // missing closing curly brace!
function bar() {
...
}
style
property to see all styles