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.

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

1 Answer

Elijah Quesada
Elijah Quesada
Front End Web Development Techdegree Graduate 30,767 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];