Revisiting Old Concepts - Window Object

Dear Sciaku Learner you are not logged in or not enrolled in this course.

Please Click on login or enroll now button.

If you have any query feel free to chat us!

Happy Coding! Happy Learning!

Lecture 183:- Revisiting Old Concepts - Window Object

The Window object is a global object in the browser environment that represents the window containing a DOM document. It is the top-level object in the JavaScript hierarchy and represents the browser window that contains the document. All global variables and functions defined in a web page are properties and methods of the window object.

The Window object provides several properties and methods that allow you to interact with the browser window, such as:

  1. Document: Represents the DOM document that is loaded in the window.
  2. Location: Represents the URL of the current window or a redirect URL.
  3. History: Represents the history of the current window.
  4. Navigator: Provides information about the browser.
  5. Screen: Provides information about the user's screen.
  6. setTimeout() and setInterval(): Allow you to execute code after a specified amount of time or at a specified interval.
  7. alert(), prompt(), and confirm(): Allow you to display dialog boxes to the user.

Some examples of using the Window object:

  1. Accessing the DOM: You can access and manipulate the DOM of the current page by using the document property of the Window object.

javascriptCopy code

window.document.getElementById('myDiv').innerHTML = 'Hello, World!';

  1. Redirecting the current page:

javascriptCopy code

window.location.href = 'http://example.com';

  1. Opening a new window:

javascriptCopy code

window.open('http://example.com', '_blank', 'width=500,height=500');

  1. Setting a timeout:

javascriptCopy code

window.setTimeout(function() {    alert('Time is up!'); }, 5000);

Overall, the Window object is an essential part of the browser environment and provides a wide range of functionality for interacting with the user and the web page.

21. Closures

2 Comments

@niteshguptav63
niteshguptav63 Nov 17, 2024 at 1:39 PM

I am not able to access videos from second class and further. I have already completed first class

@niteshguptav63
niteshguptav63 Nov 16, 2024 at 10:56 AM

When will I get my course?

@admin79
admin79 Nov 17, 2024 at 1:29 PM

Now, Your query was resolved.

Frequently Asked Questions About Sciaku Courses & Services

Quick answers to common questions about our courses, quizzes, and learning platform

Didn't find what you're looking for?

help_center Contact Support