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

Adam Hinckley
Adam Hinckley
139 Points

why is it saying I don'y have three numbers in this array?

To me, there are clearly three numbers in this array.

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

1 Answer

Elijah Quesada
.a{fill-rule:evenodd;}techdegree seal-36
Elijah Quesada
Front End Web Development Techdegree Graduate 32,961 Points

The Javascript engine will interpret that array as an array of strings and not an array of numbers.

You need to remove the quotes.

var data = [3,3,3];