JavaScript JavaScript Loops, Arrays and Objects Tracking Multiple Items with Arrays Create an Array

analyn jane calado
analyn jane calado
3,523 Points

clarify me please... what going on?

i can't get the correct answer.

var data = [1,2,3];
var assorted = [1];
var assorted = [2];
var assorted = [3];
<!DOCTYPE html>
  <meta charset="utf-8">
  <title>JavaScript Loops</title>
<script src="script.js"></script>

2 Answers

Trace Harris
Trace Harris
Python Web Development Techdegree Student 18,825 Points

So the second array should have assortment of data types, a number, a stritrng and a boolean value like true or false.

var assorted = [ "Hi my name is", true, 13];

analyn jane calado, try this or Trace Harris

Trace's example should work fine for you.

The challenge wants you to create a second array called assorted and add 3 values to the array, 1 as a string, 1 and a number and 1 and a Boolean.

Where 'I am a string' is a string because it is wrapped in quotes, 1 is a number literal if it were wrapped in quotes it would be a string representation of a number. And the last value of false or true in Trace's example is a Boolean.

var data = [1, 2, 3];

var assorted = ['I am a string', 1, false];