JSFiddle - React, Tailwind, and code Playground

JavaScript

const marbles = []
marbles.push(3)
marbles.push(5)
marbles.push(1)

console.log(marbles)

// How many marbles i gots?
const marbleCount = marbles.reduce((count, value, index) => {
  console.log(`Current index: ${index}`)
  const totalSoFar = count + value  

	console.log(`Adding ${value} marbles to our count: ${count}. No we gots: ${totalSoFar}`)

  return totalSoFar
})

console.log(`Marble count: ${marbleCount}`)