Your JavaScript report can classify one dock. Before the van leaves, the crew lead needs a count of empty docks across all five. You’ll translate the Python loop into JavaScript and count as the report visits each dock.
Loop Over the Bike Counts
The counts correspond to Elm Street, Harbor Square, Station Road, Market Hall, and Riverside Park, in that order. In Python, you’d print them with:
Language: Python
counts = [0, 14, 6, 0, 11]
for bikes in counts:
print(bikes)
In JavaScript, a list in square brackets is called an array. Arrays get their own lesson later in this course. Replace the contents of ~/dock-report/dock-report.js with this port:
Language: JavaScript
const counts = [0, 14, 6, 0, 11];
for (const bikes of counts) {
console.log(bikes);
}