Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

152
Views
Pushing counter value to array to create a string with previous values

"use strict";

let count = 0;
let totalPassengerCount = 0;
let entries = [];

const saveCount = document.getElementById("save-count");

const countEl = document.getElementById("count-el");

const resetCount = document.getElementById("reset-count");

document
  .getElementById("incremenet-btn")
  .addEventListener("click", function () {
    count += 1;
    countEl.innerHTML = count;

});

 document.getElementById("save-btn").addEventListener("click", function () {
  totalPassengerCount += count;
  entries = count.push([0]);
  count = 0;
  countEl.innerHTML = count;

  saveCount.innerHTML = totalPassengerCount;
});

resetCount.addEventListener("click", function () {
  totalPassengerCount = 0;
  count = 0;
  countEl.innerHTML = count;

  saveCount.innerHTML = totalPassengerCount;
});

const entry = document.getElementById("entry-info");

console.log(entries);

I am trying to push each saved count into an array to display as a message, however I am running into a problem where it's not actually doing it, I am fairly new to coding. All help is appreciated.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!