
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 6710 Articles for Javascript

12K+ 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. Before we jump into the article let’s have a quick view on the regex expression in JavaScript. Regex expression in JavaScript Regular expressions are patterns that can be used to match character combinations in strings. Regular expressions are objects in JavaScript. These patterns can be used with the exec() and test() methods of RegExp as well as the match(), matchAll(), ... Read More

2K+ Views
To get the number of true/ false values in an array, the code is as follows −var obj = [ { isMarried: true }, { isMarried: false }, { isMarried: true }, { isMarried: true }, { isMarried: false } ] function numberOfTrueValues(obj) { var counter = 0; for (var index = 0; index < obj.length; index++) { if (obj[index].isMarried === true) { counter++; ... Read More

4K+ Views
In this article we are going to find out whetehr it is possibleto change the value of the function parameter in JavaScript. A function accepts a certain values as parameters an later while calling this function we need to pass values for these parameters as arguments. Typically a function definition contains the name of the function, parameters (optional) and the body of the function.Syntax Following is the syntax for function parameter − function Name(paramet1, paramet2, paramet3, paramet4) { // Statements } Yes, it is possible to change the value of the function parameter in JavaScript. ... Read More

726 Views
The task we are going to perform in this article is ‘set object property in an array true/false whether the id matches with any if from another array of objects in JavaScript’. Before we jump into the article let’s have a glance at the object and array in JavaScript. An object in JavaScript is a separate entity having properties and a type. JavaScript objects have properties that specify their attributes. Multiple values can be kept in a single variable by using arrays. Compare that to a variable that only has room for one value. Each item in an array has ... Read More

2K+ Views
A class serves as a model for building objects. Code is used to encapsulate data, so that it can be worked on. Although JS classes are based on prototypes, they also have some unique syntax and semantics that are not shared by ES5 classes. Let’s dive into the article to learn more about how to add class name in different li by pure in JavaScript. To add class, use forEach() along with classList.add(). The forEach() in JavaScript For each entry in an array, the forEach() method invokes a different function. When dealing with empty elements, this method is not ... Read More

477 Views
To fetch a specific record, use find() with some condition.ExampleFollowing is the code −var obj=[ { studentId:101, studentName:"John" }, { studentId:102, studentName:"Bob" }, { studentId:103, studentName:"David" } ] const result = obj.find( (o) => { return o.studentId === 102 } ); console.log(result);To run the above program, you need to use the below command −node fileName.js.Here, my file name is demo315.js.OutputThis will produce the following output −PS C:\Users\Amit\javascript-code> node demo315.js { studentId: 102, studentName: 'Bob' }

9K+ Views
Null values can be tricky to work with in JavaScript, but they are an important part of the language. In this article, we will discuss various ways you can check if there is a null value in an object or array in JavaScript. The null values display that no object value is present. It is intentionally set to show that a variable has been declared but has not yet been given a value. The primitive value is undefined, which is an unintended absence of any object value, which is comparable to null, that contrasts with the former. This is due ... Read More

135 Views
In JavaScript, objects can be created and assigned properties in a variety of ways. One popular approach is to use the shortest syntax to assign properties from a function call to an existing object. In this article, we will explore how to use this technique and discuss some considerations when using it. An object in JavaScript is a separate entity having properties and a type. JavaScript objects can have properties that specify their attributes. Spread syntax (…) An iterable, such as an array or string, can be expanded in places where zero or more arguments or components are ... Read More

2K+ Views
The task we are going to perform in this articles is to “Remove property for all objects in array in JavaScript”. A collection of key-value pairs constitutes an object in JavaScript. A key-value pair among them is referred to as an object property. Any data type, including Number, String, Array, Object, etc., can be used for both the keys and values of properties There are two methods: one is mutable and uses the delete operator; the other is immutable and uses object restructuring. Let’s discuss this method. The delete operator The delete operator eliminates both the property's value and the ... Read More

178 Views
To fix this, you can use map() in JavaScript.The syntax is as follows −var anyVariableName= new Array(yourSize).fill().map(Object);ExampleFollowing is the code −var arrayOfObject = new Array(5).fill().map(Object); console.log(arrayOfObject);To run the above program, you need to use the following command −node fileName.js.Here, my file name is demo311.js.OutputThis will produce the following output −PS C:\Users\Amit\javascript-code> node demo311.js [ {}, {}, {}, {}, {} ]