Practice Set : Grad. Assignment 1

by Reem Al Dossary

HTML

<h2>Arrays and Looping</h2>

Open your console to see the output from this code!

<p>1- Make an array of strings and assign it to a variable. You may make the strings a list of anything you like and use any variable name you prefer.</p>

<p>2- Create another array of strings and assign it to a variable. Use different list of strings and a different variable name than the previous one. </p>

<p>3- Use one of the methods of the Array object to join the two arrays together. Looking through the methods on the Array reference page at W3Schools may be helpful.</p>

<p>4- Using the Array you made in the previous steps, iterate over its elements and write each one to the console.</p>

JavaScript

"use strict"; 

// Insert your code for #1 here
{
var warmColors=["yellow","red","orange"];

// Insert your code for #2 here

var coldColors= ["blue","purple","violet"];

// Insert your code for #3 here

var rainBow = warmColors.concat(coldColors);

// Insert your code for #4 here

for (var i=0; i<rainBow.lenght;i++);

console.log("My rainbow colors are:" +rainBow);

}