Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Javascript Articles
Page 183 of 534
How does JavaScript work behind the scene?
JavaScript is a powerful language that has revolutionized frontend development. Understanding how JavaScript works behind the scenes is crucial for writing efficient code and debugging effectively. JavaScript is a synchronous, single-threaded language that executes code in a specific order. Everything in JavaScript runs inside an Execution Context, which is the environment where code is executed. What is an Execution Context? The Execution Context consists of two main components: Memory Component ...
Read MoreHow to Add Google Maps to a Website?
In this article, we will be exploring Google Maps and how to add or embed google maps into our HTML template/website. Once the Google Maps are embedded into the website we can pin a location in it to display the user the current position of the store or a company. Steps to Embed Google Maps Below are the steps that need to be followed to embed Google Maps into your HTML pages: We need to generate an API key to be able to use Google maps privately. Creating the HTML ...
Read MoreHow to add HTML elements dynamically using JavaScript?
Adding HTML elements dynamically with JavaScript allows you to modify page content in real-time based on user interactions. This technique is essential for creating interactive web applications and dynamic user interfaces. Approach Create a simple HTML page with a container element where new content will be added Define the HTML structure you want to add dynamically Use JavaScript to listen for user events (like button clicks) Dynamically insert new HTML elements using DOM manipulation methods Style the elements with CSS to maintain ...
Read MoreHow to call a JavaScript function in HTML?
In this article, we will explore how to call and initialize JavaScript functions from HTML templates. JavaScript functions allow us to execute desired operations and respond to user interactions on web pages. There are several ways to call JavaScript functions in HTML. We'll discuss the most common approaches with practical examples. Using Event Handlers (onclick) The most common way to call JavaScript functions is through event handlers like onclick. When a user interacts with HTML elements (buttons, links, etc.), the associated JavaScript function executes. JavaScript Function Call Example ...
Read MoreHow to call the constructor of a parent class in JavaScript?
In JavaScript, when working with inheritance, you often need to call the parent class constructor from the child class. This is accomplished using the super() method, which provides access to the parent's constructor and methods. What is a Constructor? A constructor is a special method that runs when creating a new instance of a class. It's used to initialize object properties and set up the object's initial state. In JavaScript, constructors are defined using the constructor keyword within a class. Inheritance in JavaScript Inheritance allows objects to access properties and methods from parent objects. Child classes ...
Read MoreHow to chain asynchronous functions in JavaScript?
JavaScript is a single-threaded language that executes operations synchronously by default. Synchronous operations can be time-consuming and block other operations in the thread. JavaScript provides asynchronous programming capabilities that allow functions to execute without blocking other operations. This is achieved through asynchronous constructs like Promises, async/await, and callbacks. Asynchronous functions are powerful, but their unpredictable execution timing can create challenges. Chaining these functions ensures they execute in a specific order, making your code more predictable and easier to debug. In this article, we will explore different methods for chaining asynchronous functions using modern JavaScript features. The ...
Read MoreJavaScript: How to check whether an array includes a particular value or not?
In JavaScript, there are several ways to check whether an array includes a particular value. This article explores different approaches to search for values in arrays effectively. Array Creation Syntax let array = [arrayItem1, arrayItem2, arrayItem3, ...]; Using for Loop (Traditional Approach) The traditional approach involves looping through all array elements and comparing each value with the target value. This method also allows you to find the index of the element. Array Value Check ...
Read MoreHow to compile a Typescript file?
In this article we are going to explore TypeScript and how to compile and execute TypeScript files. TypeScript is an open-source programming language developed and maintained by Microsoft. TypeScript is syntactically similar to JavaScript but adds additional features like static typing and object-oriented programming. Unlike JavaScript, TypeScript does not run directly in web browsers and must be compiled to JavaScript first. TypeScript files need to be transpiled to JavaScript before they can be executed. This compilation process converts TypeScript syntax into standard JavaScript that browsers and Node.js can understand. Prerequisites Before compiling TypeScript files, you need ...
Read MoreHow to convert a string of any base to an integer in JavaScript?
An integer can be represented in various formats in programming languages such as Binary (base 2), Decimal (base 10), Hexadecimal (base 16), and Octal (base 8). A Binary number consists of two digits only (0 & 1), whereas a decimal consists of digits from 0 to 9. We can convert a string to an integer using the parseInt() method. When the integer is represented in a different base, we need to pass the base parameter to decode it correctly. Syntax parseInt(string_value, base) parseInt(string_value) // Defaults to base 10 Parameters ...
Read MoreJavaScript: How to Create an Object from Key-Value Pairs
In JavaScript, there are several ways to create objects from key-value pairs. Whether you have individual keys and values or arrays of data, you can build objects dynamically using different approaches. Using Object Literal Syntax The simplest way is to create an empty object and assign properties directly: Object Using Key-value Pair Welcome to Tutorials Point let object = {}; let firstKey ...
Read More