Lokesh Yadav has Published 52 Articles

How to remove existing HTML elements in JavaScript?

Lokesh Yadav

Lokesh Yadav

Updated on 06-Sep-2023 13:57:02

39K+ Views

This article discusses about how to delete an existing element in JavaScript. To remove the existing HTML elements, we first need to select the element to be deleted from the document. Then, use the methods like remove() and removeChild() in JavaScript to delete the elements from the document. We’ll discuss ... Read More

How to add a new element to HTML DOM in JavaScript?

Lokesh Yadav

Lokesh Yadav

Updated on 02-Sep-2023 02:08:51

68K+ Views

In this article we are going to discuss how to add a new element to HTML DOM in JavaScript. The Document object provides a method createElement() to create an element and appendChild() method to add it to the HTML DOM. Following are the steps involved in creating HTML DOM − ... Read More

How to convert a string into integer in JavaScript?

Lokesh Yadav

Lokesh Yadav

Updated on 29-Aug-2023 07:18:01

206K+ Views

In this article, we’ll go over how to convert a string into integer in JavaScript with appropriate examples. To convert a string to an integer parseInt(), Number(), and Unary operator (+) function is used in JavaScript. The parseInt() function returns NaN ( not a number) when the string doesn’t contain ... Read More

Weekday as a number in JavaScript?

Lokesh Yadav

Lokesh Yadav

Updated on 09-Dec-2022 10:19:11

3K+ Views

In this article, we are going learn about the weekday as a number in JavaScript with appropriate examples. To get the weekday as a number, JavaScript has provided getDay() method. The getDay() is a method from Date object. The getDay() method returns a value between 0 to 6. For example, ... Read More

Merge sort vs quick sort in Javascript

Lokesh Yadav

Lokesh Yadav

Updated on 09-Dec-2022 10:17:35

509 Views

In this article, we are going to discuss about the differences between merge sort and quick sort in JavaScript with appropriate examples. Merge sort and Quick sort are used to sort the elements, but the approach is different. Both Merge sort and quick sort are based on Divide and Conquer ... Read More

d vs D in JavaScript?

Lokesh Yadav

Lokesh Yadav

Updated on 09-Dec-2022 10:16:12

2K+ Views

This article discusses about \d vs\ D in JavaScript regex. The \d and \D meta characters are used to match the characters of a given string. \d and \D are different from each other. \d (character) is equivalent to [0-9] that means it matches any single number. The characters that ... Read More

w vs W in JavaScript regex?

Lokesh Yadav

Lokesh Yadav

Updated on 09-Dec-2022 10:13:21

3K+ Views

This article discusses about the \w vs \W in JavaScript regex. The \w and \W meta characters are used to match the characters of a given string. \w and \W are different from each other. \w (character) is equivalent to [a-zA-Z0-9_] that means it matches any single letter, number, or ... Read More

Super keyword in JavaScript?

Lokesh Yadav

Lokesh Yadav

Updated on 09-Dec-2022 10:09:56

789 Views

In this article, we are going to discuss about the super keyword in JavaScript with suitable examples. The Super keyword is basically used in Object Oriented Programming. The Super keyword is used to call parameters and functions of an object’s parent. There are times a parent class and sub class ... Read More

Execute digits in even places in a JavaScript array?

Lokesh Yadav

Lokesh Yadav

Updated on 09-Dec-2022 10:08:19

89 Views

In this article, the given task is to execute digits in even places in a JavaScript array with suitable examples. To execute the digits in even places in a JavaScript array, we need to get the starting index of the array and we need to loop through it by checking ... Read More

How "getElementByID" works in JavaScript?

Lokesh Yadav

Lokesh Yadav

Updated on 09-Dec-2022 10:06:26

6K+ Views

This article discusses about how “getElementByID” method work in JavaScript. The getElementByID() method in JavaScript is a document method. When we give a specific string which should match the ID of the HTML element, it returns the element object. Every HTML element can be assigned a unique ID. If two ... Read More

Advertisements