Array Implementation in JavaScript

var testScores = [78, 90, 62, 88, 93, 50]; // Decleration of Array..
var highestScore = testScores[4]; // Finding element of Array..
testScores[5] = 71; // Modify the array..
testScores.push(89); // Insert a value at last position..
testScores.unshift(74, 58); // You can also add a new element to the beginning of an array using the unshift() method.
testScores.pop(); // This method lets you delete the last element in an array
testScores.shift(); // The shift() method to remove the first element of an array.

console.log(testScores);
console.log("Length of the Array is: "+(testScores.length)); // Print the nmber of elements of the array..

Comments

Popular posts from this blog

Average of All Indexes of Array

JavaScript Coding Challenge-8

Largest and Lowest Number of the Array using JavaScript