JavaScript Objects
摘要:"Everything" in JavaScript is an Object: a String, a Number, an Array, a Function....In addition, JavaScript allows you to define your own objects.JavaScript ObjectsJavaScript has several built-in objects, like String, Date, Array, and more.An object is just a special kind of data, with pr
阅读全文
The HTML DOM (Document Object Model)
摘要:With the HTML DOM, JavaScript can access all the elements of an HTML document.The HTML DOM (Document Object Model)When a web page is loaded, the browser creates a Document Object Model of the page.The HTML DOM model is constructed as a tree of ObjectsThe HTML DOM TreeWith a programmable object model
阅读全文
JavaScript Errors - Throw and Try to Catch
摘要:The try statement lets you test a block of code for errors.The catch statement lets you handle the error.The throw statement lets you create custom errors.Errors Will Happen!When the JavaScript engine is executing JavaScript code, different errors can occur:It can be syntax errors, typically coding
阅读全文
JavaScript Loops
摘要:Different Kinds of LoopsJavaScript supports different kinds of loops:for - loops through a block of code a number of timesfor/in - loops through the properties of an objectwhile - loops through a block of code while a specified condition is truedo/while - also loops through a block of code while a s
阅读全文