Mayank Agarwal has Published 403 Answers

JavaScript: How to check if a number is even without using the modulo operator?

Mayank Agarwal

Mayank Agarwal

Updated on 22-Apr-2022 13:20:34

Often we need to check whether a number is odd or even and return the same to the user. In this article also we will be checking whether a number is even or not but without using the modulo operator. It’s pretty easy to check whether a number is even ... Read More

How to chain asynchronous functions in JavaScript?

Mayank Agarwal

Mayank Agarwal

Updated on 22-Apr-2022 12:54:13

JavaScriptis a single-threaded synchronous function that performs operations. It is a timeconsuming operation that blocks other operations of the thread.We can use the asynchronous programming provided by JavaScript that performs functions without blocking other operations of the thread. This can be done by asynchronous code like promises or async functions ... Read More

How to call the constructor of a parent class in JavaScript?

Mayank Agarwal

Mayank Agarwal

Updated on 22-Apr-2022 12:46:27

In this article, we are going to explore constructors in an object. We can create inheritance in terms of object, i.e. a parent object can have one or multiple child objects. Now we can call the constructors of a parent object from the child object.ConstructorThese are the instances of a ... Read More

How to call a JavaScript function in HTML?

Mayank Agarwal

Mayank Agarwal

Updated on 22-Apr-2022 12:40:47

In this article, we will be exploring the calling and initialization of the JavaScript function from an HTML template. We require the JavaScript function to execute the desired methods over the input passed.In this tutorial, we will be discussing two major approaches to calling a JavaScript function from an HTML ... Read More

How to add HTML elements dynamically using JavaScript?

Mayank Agarwal

Mayank Agarwal

Updated on 22-Apr-2022 12:31:57

In this article, we will be exploring how to add HTML elements dynamically so that they could change the view component. Also not just an HTML element, we can also add CSS properties to HTML elements with the help of JavaScript. In this article, we will be using a button ... Read More

How to Add Google Maps to a Website?

Mayank Agarwal

Mayank Agarwal

Updated on 22-Apr-2022 12:25:45

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.StepsBelow ... Read More

How does JavaScript work behind the scene?

Mayank Agarwal

Mayank Agarwal

Updated on 22-Apr-2022 12:19:48

JavaScript is a relatively new language with lots of new features and enhancements over the traditional HTML & CSS pipelines. With the new age era, JavaScript has captured most of the frontend market in a relatively lower period of time. It has gained tremendous popularity and is the go to ... Read More

How does asynchronous code work in JavaScript?

Mayank Agarwal

Mayank Agarwal

Updated on 22-Apr-2022 12:15:14

In this article, we will be exploring how async code actually works in JavaScript, how it is initialized, and how it is executed and called. But before moving on let’s look at what is synchronous code and how it is different from asynchronous codeSynchronous Code − This implies that the ... Read More

How to access HTML elements in JavaScript?

Mayank Agarwal

Mayank Agarwal

Updated on 21-Apr-2022 14:15:34

In HTML, sometimes the user needs to access the HTML elements to display the user different changes. We can support this by using modern-day JavaScript. To facilitate this, we can move ahead and change the HTML element by using the following techniques −Get HTML element by IdGet HTML element by ... Read More

Difference Between Static and Const in JavaScript

Mayank Agarwal

Mayank Agarwal

Updated on 21-Apr-2022 13:59:45

Static variables can be defined as a class property that is used in a class and not on the class instance. This type of variable is stored in the data segment area of the memory. The value assigned to these types of variables is shared among every instance that is ... Read More

Previous 1 ... 4 5 6 7 8 9 10 ... 41 Next
Advertisements