JavaScript Document Object Model or DOM

The Document Object Model (DOM) is a programming interface for web documents. It represents the page so that programs can change the document structure, style, and content. The DOM represents the document as nodes and objects. That way, programming languages can interact with the page. JavaScript is often used to manipulate the DOM, because it …

Regular Expressions and RegExp Object

Regular expressions (regex or regexp) are patterns used to match character combinations in strings. They are used in many programming languages, including JavaScript, to perform search and replace operations and data validation. In JavaScript, regular expressions are represented by the RegExp object. To create a regular expression, you can use the constructor function of the …

JavaScript The Math Object

The Math object is a built-in object in JavaScript that provides a collection of mathematical functions and constants. These functions and constants can be accessed using the Math object and can be used to perform various mathematical operations. Here are some commonly used methods and constants of the Math object: Note that all of these …

JavaScript The Date Object

The Date object is a built-in object in JavaScript that allows you to work with dates and times. You can create a new instance of the Date object with or without arguments. Here are some examples of how to use the Date object: let currentDate = new Date(); console.log(currentDate); let specificDate = new Date(‘March 18, …

JavaScript The Arrays Object

In JavaScript, the Arrays object is a built-in object that provides a set of methods for working with arrays. An array is a collection of values that are stored in a single variable. The Arrays object allows you to manipulate arrays in various ways, including adding and removing elements, sorting, searching, and iterating over the …

JavaScript The Strings Object

In JavaScript, the Strings object provides a number of methods for working with strings. Here are some commonly used methods: const myString = “hello world”; console.log(myString.length); // 11 const myString = “hello world”; console.log(myString.toUpperCase()); // “HELLO WORLD” const myString = “HELLO WORLD”; console.log(myString.toLowerCase()); // “hello world” const myString = “hello world”; console.log(myString.charAt(1)); // “e” const …

JavaScript The Boolean Object

In JavaScript, the Boolean object is a wrapper around a primitive boolean value (either true or false). The Boolean object provides methods and properties to manipulate and work with boolean values. Here’s an example of creating a Boolean object: var boolObj = new Boolean(true); console.log(boolObj); // logs: Boolean {true} In this example, we create a …

JavaScript The Number Object

In JavaScript, the Number object is a built-in object that represents a numerical value. It can be used to perform mathematical operations, and provides several methods for formatting and manipulating numbers. Here are some basic examples of using the Number object: let num = new Number(10); // creates a number object with a value of …

JavaScript Objects Overview

JavaScript objects are one of the fundamental data types in the language, and are used extensively in web development. They allow developers to store and organize related data and functions, and can be created and manipulated dynamically at runtime. In JavaScript, an object is essentially a collection of key-value pairs, where the keys are strings …

JavaScript Page Printing

To print a web page using JavaScript, you can use the window.print() method. This method will open the print dialog box and allow the user to choose their print settings before printing the page. Here’s an example of how to use window.print(): // Wait for the page to finish loading window.onload = function() { // …