Master a Array and Method With proper Example
Array is a special variables ,which can hold more than one value:
const cars = ["Saab", "Volvo", "BMW"];
Accessing a Array
You access an array element by referring to the index number:
const cars = ["Saab", "Volvo", "BMW"];
let car = cars[0];
Some of the Important Question In an array
Looping through the array
const cars = ["Saab", "Volvo", "BMW"];
for (let i = 0; i < cars.length; i++) { console.log(cars[i]); }
Here is the Output
Saab
Volvo
BMW
Practice Question For You :
Find the sum of number in an array.
Find the Maximum and minimum number in an array.
Find the second largest element in an array
Find whether the element is in ascending or descending in an sorted array
Find the index of element in an sorted array
Here is the answer
0 Comments
Connect with us