Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

2. Working with Objects and Properties > Host Objects versus Native Objects

Host Objects versus Native Objects

You should be aware that the environment (e.g., a web browser) in which JavaScript is executed typically contains what are known as host objects. Host objects are not part of the ECMAScript implementation, but are available as objects during execution. Of course, the availability and behavior of a host object depends completely on what the host environment provides.

For example, in the web browser environment the window/head object and all of its containing objects [excluding what JavaScript provides] are considered host objects.

Below, I examine the properties of the window object.

Live Code

<!DOCTYPE html><html lang="en"><body><script>

for (x in window) {
   console.log(x); //logs all of the properties of the window/head object
}

</script></body></html>

  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint