Yaswanth Varma has Published 334 Articles

How to detect and replace all the array elements in a string using RegExp in JavaScript? 

Yaswanth Varma

Yaswanth Varma

Updated on 21-Apr-2023 17:24:34

1K+ Views

An array is an ordered list of values in JavaScript. The term "element designated by an index" refers to each value: The following traits describe a JavaScript array: An array can initially store values of many sorts. You could, for instance, store elements of the number, string, Boolean, and null ... Read More

Make strings in array become keys in object in a new array in JavaScript?

Yaswanth Varma

Yaswanth Varma

Updated on 21-Apr-2023 17:23:05

2K+ Views

The task we are going to perform in this article is make strings in array become keys in object in a new array in JavaScript. Let’s consider a simple array − let array= ['bike', 'car'] Now, we are going to use map() to convert the above array to a ... Read More

How to count number of occurrences of repeated names in an array - JavaScript?

Yaswanth Varma

Yaswanth Varma

Updated on 21-Apr-2023 17:05:26

1K+ Views

An array in JavaScript is a group of identically typed elements that are stored in adjacent memory locations and may each be separately referred to using an index to a special identifier. Let’s consider an array consisting of occurrences of repeated names. The array looks like this − var details ... Read More

Is it possible to create a new data type in JavaScript?

Yaswanth Varma

Yaswanth Varma

Updated on 21-Apr-2023 17:03:31

3K+ Views

The task we are going to perform in this article is it possible to create a new data type in JavaScript. For instance, let’s consider we have variable student − var student = "username" console.log(typeof student) Now, I want to declare the type of that variable and print that ... Read More

How do I change a tag's inner HTML based on their order in JavaScript?

Yaswanth Varma

Yaswanth Varma

Updated on 21-Apr-2023 17:01:34

728 Views

The innerHTML property of an element in JavaScript allows you to access or modify any HTML or XML markup that is there. Use the method insertAdjacentHTML () to insert HTML into the page as opposed to changing an element's content. In JavaScript to change a tag’s innerHTML based on their ... Read More

How to format date value in JavaScript?

Yaswanth Varma

Yaswanth Varma

Updated on 21-Apr-2023 16:59:26

526 Views

To obtain dates in JavaScript, use either the new Date() or Date() function Object() { [native code] } (either current date or a specific date). While the Date() function Object()produces a string containing the current date and time, the new Date() function Object()creates a new Date object. Let’s dive into ... Read More

Capitalize a word and replace spaces with underscore - JavaScript?

Yaswanth Varma

Yaswanth Varma

Updated on 21-Apr-2023 16:58:12

2K+ Views

We will try to develop a method to change text with spaces and lowercase letters into text with underscores, where the initial letter of each word is capitalized. Let's examine the equation in its entirety. tutorials point = Tutorials_Point //expected output Let’s dive into article for getting better understanding ... Read More

How to remove all blank objects from an Object in JavaScript?

Yaswanth Varma

Yaswanth Varma

Updated on 21-Apr-2023 16:46:59

3K+ Views

The task at hand is to learn how to remove all blank objects from a JavaScript object. Let’s consider the following object − const details = { name: 'John', age: {}, marks: { marks: {} } } We need to ... Read More

How to replace all the special characters following another character – JavaScript?

Yaswanth Varma

Yaswanth Varma

Updated on 21-Apr-2023 16:45:58

1K+ Views

Characters that are neither alphabetical nor numeric are known as special characters. Special characters are essentially all unreadable characters, including punctuation, accent, and symbol marks. Remove any special characters from the string to make it easier to read and understand. We use replace() method to replace all the special characters ... Read More

Do JavaScript arrays have an equivalent of Python’s "if a in list"?

Yaswanth Varma

Yaswanth Varma

Updated on 21-Apr-2023 16:44:43

752 Views

In JavaScript Arrays are used to store multiple values in a single variable. This is compared to a variable that can store only one value. Each item in an array has a number attached to it, called a numeric index, that allows you to access it. In JavaScript, arrays start ... Read More

Advertisements