Question: CODE IN JAVASCRIPT Consider the following array declaration: let cars = [Saab, Volvo, BMW]; Add Toyota to the end of the array Add Mercedes to

CODE IN JAVASCRIPT

  1. Consider the following array declaration: let cars = ["Saab", "Volvo", "BMW"];

    • Add Toyota to the end of the array

    • Add Mercedes to the beginning of the array.

    • Create a displayArray function that takes an array as argument and print the array elements individually using a For-of loop. Call the function to display the cars array.

    • Sort the array alphabetically and print it again.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!