JavaScript
Introduction to the DOM
What is the DOM? A programming API for documents. The Document Object Model (DOM) is a cross-platform and language-independent interface that treats an XML or HTML document as a tree structure wherein each node is an object representing a part of the document. The DOM represents a document with a[...]
How to apply CSS to iframe?
How to Style Embedded HubSpot Forms in an iFrame with JavaScript and jQuery When embedding forms from third-party services like HubSpot within your website, there are times you might want to customize the styling of those forms to better match your website’s design. However, styling content inside an iFrame can[...]
JavaScript Map, Reduce, and Filter
Map, reduce, and filter are all array methods in JavaScript. Each one will iterate over an array and perform a transformation or computation. Each will return a new array based on the result of the function. In this article, you will learn why and how to use each one. Map[...]
JavaScript Concepts Everyone Should Learn!
Spread operator let data = { username: "GauravJ", email: "email@gmail.com", favLang: "JavaScript", }; let data_updated = { ...data, favLang: "Java" }; console.log(data_updated); Destructuring let data = { username: "GauravJ", email: "email@gmail.com", favLang: "JavaScript", }; let { username, email, favLang } = data; //Destructuring Async js Promises and callback Async-await[...]
JavaScript: localStorage and sessionStorage
HTML web storage provides two objects for storing data on the client: window.localStorage - stores data with no expiration date window.sessionStorage - stores data for one session (data is lost when the browser tab is closed) Before using web storage, check browser support for localStorage and sessionStorage: if (typeof(Storage) !==[...]
JavaScript: Array functions/methods
Javascript is a web programming language used in modern web development. Many frameworks and libraries built in Javascript like Angular, React, Jquery, etc. Arrays are the data structure that can store a collection of elements of the same type. To perform a different type of operation on an array we[...]
JavaScript: Array map() Method
The map() method creates a new array populated with the results of calling a provided function on every element in the calling array. const array1 = [1,4,9,16]; // pass a function to map const map1 = array1.map(x => x * 2); console.log(map1); // expected output: Array [2, 8, 18, 32][...]
Promise in JavaScript with example
What is a Promise in JavaScript? A promise is an object and it used to handle asynchronous operations in javascript. A promise has three states: pending fulfilled rejected The Promise object supports two properties: state and result. While a Promise object is "pending" (working), the result is undefined. When a[...]
JavaScript: FormData
The FormData interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the fetch(), XMLHttpRequest.send() or navigator.sendBeacon() methods. It uses the same format a form would use if the encoding type were set to "multipart/form-data". Constructor FormData() Creates[...]
JavaScript: How ES6 Arrow Function Can Help You
An Arrow function is a compact alternative to a traditional function expression, but is limited and can't be used in all situations. Syntax: //One param. With simple expression return is not needed: param => expression //Multiple params require parentheses. With simple expression return is not needed: (param1, paramN) => expression[...]