Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

237
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda