What is the role of Browser Object Model (BOM) in JavaScript?

The Browser Object Model (BOM) in JavaScript includes the properties and methods for JavaScript to interact with the web browser.

BOM provides you with a window objects, for example, to show the width and height of the window. It also includes the window.screen object to show the width and height of the screen.


You can try to run the following code to learn how to get screen height and width −

Live Demo

<!DOCTYPE html>
         document.write("Screen width: " + screen.width);
         document.write("<br>Screen width: " + screen.width);

karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know

Updated on: 23-Jun-2020

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started