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

Bohdan Shvets
Bohdan Shvets
3,914 Points

why it is nit work? var data[1,2,3];

why it is nit work? var data[1,2,3];

script.js
var data [1,2,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

Steven Parker
Steven Parker
182,340 Points

You forgot to include the assignment operator (=):

var data = [1,2,3];