
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

124 Views
The Array.of() method of JavaScript is used to create a new array instance with variables as parameter values.The syntax is as follows −Array.of(elements....)Above, elements are the values as parameter values.Let us now implement the Array.of() method in JavaScript −Example Live Demo Demo Heading Click the button to display the values in Console Result function display() { console.log(Array.of(10, 20, 30, 40 ,50)); } OutputClick the “Result” and check the Console for the output −Example Live Demo ... Read More

266 Views
The array.keys() method of JavaScript is used to return an Array Iterator object with the keys of an array.The syntax is as follows − array.keys()Let us now implement the array.keys() method in JavaScript −Example Live Demo Car Variants var arrStud = ["Crossover", "Convertible", "Hatchback", "SUV"]; var res = arrStud.keys(); for (val of res) { document.getElementById("test").innerHTML += val + ""; } OutputExample Live Demo Ranking Points Click the button to display ... Read More

243 Views
The Array.isArray() method of JavaScript is used to determine whether an object is an array or not.The syntax is as follows −Array.isArray(ob)Above, the ob parameter is the object to be tested.Let us now implement the Array.isArray() method in JavaScript −Example Live Demo Ranking Points Is this an array? Click the below button to get the answer... Result var pointsArr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 1000]; var res = pointsArr.entries(); for (val of res) { ... Read More

171 Views
The array.includes() method of JavaScript is used to check whether an array contains a specified element.The syntax is as follows −array.includes(ele, start)Above, the parameter ele is the element to search for. The start parameter is the position to begin the search with.Let us now implement the array.includes() method in JavaScript −Example Live Demo Car Variant Result var carid = ["110", "230", "299", "399"]; document.getElementById("test").innerHTML = carid; function display() { var n = carid.includes("230"); document.getElementById("test").innerHTML = ... Read More

271 Views
The array.flatMap() method of JavaScript is used to flatten the input array element into a new array.The syntax is as follows − array.flatMap(function callback(current_value, index, Array))Let us now implement the array.flatMap() method in JavaScript −Example Live Demo Ranking Points Is any point equal to 550 from the key-value pairs... Result var pointsArr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 1000]; var res = pointsArr.flatMap(val => [val + 10]).entries(); for (val of res) { document.getElementById("test").innerHTML += ... Read More

156 Views
The array.entries() method of JavaScript is used to return an Array Iterator object with key/value pairs.The syntax is as follows − array.entries()Let us now implement the array.entries() method in JavaScript −Example Live Demo Ranking Points Is any point equal to 550 from the key-value pairs... Result var pointsArr = [10, 20, 30, 40, 50, 60, 70, 80, 90, 1000]; var res = pointsArr.entries(); for (val of res) { document.getElementById("test").innerHTML += val + ""; } ... Read More

190 Views
The from() method of JavaScript is used to return the Array object from any object with a length property or an iterable object.The syntax is as follows −Array.from(obj, mapFunction, val)Above, the parameter obj is the object to convert to an array, mapFunction is a map function to call, val is a value to use as this when executing the mapFunction.Let us now implement the from() method in JavaScript −Example Live Demo Demo Heading var arr1 = Array.from("PQRS"); var arr2 = Array.from("12345"); document.getElementById("test").innerHTML = arr1 ... Read More

802 Views
The findIndex() method of JavaScript is used to return the index of the first element in an array, if the condition is passed.The syntax is as follows −array.findIndex(function(currentValue, index, arr), thisValue)Let us now implement the findIndex() method in JavaScript −Example Live Demo Rank Result Finding the index of the player with highest rank. var points = [100, 150, 200, 250, 300, 400]; function topRank(points) { return points >= 400; } function display() { ... Read More

403 Views
The fill() function is a built-in function of JavaScript which is used to fill all the elements of an array with a static value. This function modifies the original array and returns the modified array. The fill() function of JavaScript is a simple and basic function used to fill an array with a specified function. In this article, you will understand the usage and functionality of the fill() function of JavaScript. Syntax The basic syntax of the fill() function is mentioned below: array.fill(val, start, end) Let's understand the parameters used in the fill() function. ... Read More

363 Views
The find() method of JavaScript is used to return the first elements value in an array, if the condition is passed, otherwise the return value is undefined. The syntax is as follows −array.find(function(val, index, arr), thisValue)Here, function is a function with val, which is the value of the current element. The index is the array index, and arr is the array. The this value parameter is the value to be passed to the function.Example Live Demo Ranking Points Get the points (first element) above 400... Result var pointsArr = ... Read More