BOM (Browser Object Model)

  • There is no standardization done
  • It is represented by window object
  • Javascript can talk to Browser using BOM
  • It includes:
    • navigator
    • screen
    • location
    • history
    • document (DOM)

DOM (Document Object Model)

  • It is part of BOM (window)
  • It is represented by document
  • It stores the the content of the page as tree data structure which can be manipulated by javascript

Global object

  • In Browser environment window is global object
  • In Nodejs environment global is global object
// Browser - create a global variable
window["myvar"] = value
 
// Nodejs - create a global variable
global["myvar"] = value
  • The properties of global object can be accessed directly without mentioning global variable
window["myvar"] = 3;
console.log(window.myvar); // 3
console.log(myvar); // 3