JavaScript globalThis Object18 Mar 2025 | 3 min read JavaScript can access the global object using the global object property. The global object in JavaScript is called a window in a web browser. It is also referred global or web worker, Depending on the environment. The JavaScript frameworks with web servers use the globalThis property uniformly to get to the global object. Why do we use the globalThis object?
Global keyword and its environment tableThe following table shows the javascript output environment and its supported global keyword.
SyntaxThe following syntax uses in the script tag to operate a global object. It is directly used in the console and other output tabs. ExamplesThe multiple examples show the javascript variable with the global data in the output tab. Example 1 The following basic example shows gloabalThis variable with the process in the console tab. Output The image shows the output of the global object. ![]() Example 2 The following basic example shows gloabalThis variable with other functions in the console tab. Output The image shows the output of the global object. ![]() Example 3 The following basic example shows gloabalThis variable with the console tab. Output The image shows the output of the global object. ![]() Example 4 The following basic example shows gloabalThis variable with the alert tab. Output The image shows the output of the global object. ![]() Example 5 The following basic example shows gloabalThis variable with the onclick function. Output The image shows the output of the global object. ![]() Example 6 The following basic example shows gloabalThis variable with the typeof function. Output The image shows the output of the global object. ![]() Compatible BrowsersThe javascript globalThis object is supported by the below browsers.
ConclusionThe "objectThis" is referred to javascript as ES11 or ES2020. It is available in ECMA Script 2020. The globalThis object is used to create cross-platform code, meaningful code that can run in various JavaScript environments. Next TopicJavaScript Logical Assignment Operators |
In this article, we will explain about the javaScript and the ripple effect. After that, we will learn the various practical examples of ripple effects with the help of JavaScript. What do you mean by JavaScript? JavaScript is a client-side high-level, interpreted programming and scripting language used...
6 min read
In JavaScript, it is quite simple and easy to get and set the scroll position of an element of JS and especially when a user is building a user interface in the web browser. As when creating a user interface, we need to have an...
2 min read
? A radio button is an icon that is used in forms to take input from the user. It allows the users to choose one value from the group of radio buttons. Radio buttons are basically used for the single selection from multiple ones, which is...
8 min read
displays the y-coordinates or height of the given element. The read-only MouseEvent offsetY attribute returns the y-coordinate of the mouse cursor for the target element. We can add the event function on the div tag, web page, or other elements to display y-coordination. Syntax The following...
3 min read
What is Underscore.js? Underscore.js is the library in JavaScript which has a lot of functions like map, filter, chain, etc., and these functions are applied directly on the objects or arrays. In this article, we are going to talk about one of the Underscore.js functions which is...
7 min read
In this article, we will understand the Filterable Gallery Using Filterizr javascript library. Filterable Gallery is a customizable component that is used to display collection of images, videos or other media with filtering, sorting, and searching function. Following are the examples of Filterable Gallery Using Filterizr...
7 min read
We can add single or multiple data in the database using the javascript indexedDB function. The indexedDB database inserts data using a unique column id, and increment column id increases the column as per data. The other column inserts value as per user requirement. The...
8 min read
Sometimes, programmers require to create a string which is generated by selecting the random characters. Random String Generator helps to create a random string by choosing some characters randomly. This string can be a simple character string or an alpha-numeric string. In this chapter, you will...
6 min read
In this section, we will learn about the implementation of Stack using JavaScript arrays. What is a Stack A data structure in which we place the elements in Last In First Out, i.e., LIFO principle. The LIFO principle means the arrangement of the element in such a...
6 min read
Javascript, being a broad and varied-natured programming language consists of an ample amount of features to convert an object into an array. These methods are predefined in the language itself. Let's look at the different ways of converting objects to arrays in javascript. To convert an...
4 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India