Debugging page styles or scripts with Firebug and Chrome-devtoolbar is a daily must-do for front-end development. What kind of magical help can this development artifact bring us? These days to see some of the information to give me inspiration, can not through Firebug and Chrome-devtoolbar to discover the whole properties of JS global object? Can you find the attributes in the document object that are not commonly used and require deep understanding?
We're here to open 8!
I. Brief analysis of For-in statement
The for-in Loop, also known as an "enumeration," is used on a non-array object's traversal, which can return the value of a property or property in an object.
Technically, you can use the For-in Loop array (because the array in JavaScript is also an object), but this is not recommended. Because if the array object has been enhanced by custom functionality, a logic error can occur. Also, in For-in, the order (sequence) of the list of attributes is not guaranteed. So the best array uses the normal for loop, and the object uses the For-in loop.
There is an important hasOwnProperty () method that filters out attributes that extend or inherit from the prototype chain when traversing object properties.
Let's look at an example here:
// Object var obj = { 2, 2, 1 }; // extended a method to all objects if (typeof Object.prototype.other = = = "undefined") { function () {};}
We're using obj.other now.
Two. What is the object?
Three. Traversal method for a very simple object
Four. Native objects, built-in objects, and host objects in JavaScript
Five. New Reference manual: Learn the JavaScript language in depth using Firebug or Chrome-devtoolbar
Use Firebug or Chrome-devtoolbar to learn more about the JavaScript language core