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

238
Views
Javascript function not working without return

When i use return at the and of function it renders as i want but if i dont use return it dont render.

const controlNext = function () {
  if (model.state.counterData.type === "work") {
    model.state.counterData.time = 300; //changes time data
    model.state.counterData.type = "timeout"; //changes time type
    renderClock(); //changes time data as min:sec and renders it
    clock.renderStatus("timeout"); //renders time type
    if (model.state.workData.currentWorkNum === -1) {
      return;
    } //if there is no work in query returns
    model.state.workData.works[model.state.workData.currentWorkNum].repeat--; //if there is work in query it gets one number down
    work.renderToList(model.state.workData.works); //renders works
    return; //if i dont use this return it dont render time data and renderstatus
  }
};


  listenNext(func) {
this._nextButton.addEventListener("click", function () {
  func();
})}//controlnext is in this function as argument
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!