<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);
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.