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

196
Visualizações
JS code to flowchart containing functions

I need to construct the flowchart of this JS code. I can't understand how I should include functions in flowchart, any ideas?

    function someYear(year) {
    return(year%4 == 0);
}
function someMonth(month, year) {
    if (month == 1) {
        return "January";
    }
    else if (month == 3) {
        return "March";
    }
    else if (month == 2 && someYear(year)) {
        return "February" + y;
    }
    else if (month == 2 && someYear(year) == false) {
        return "February";
    }
    else {
        return "The month is not in list";
    }
}
console.log(someMonth(2, 2007));
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

I think this image will give you the idea.

about 4 years ago · Juan Pablo Isaza Relatório

0

Either you can use the functional representation that is used in the comment of @seymurium, or you can represent the logic that lies under the target function directly instead of the function body.

In your case someMonth() function needs to be replaced with 5 conditional statements.

about 4 years ago · Juan Pablo Isaza Relatório
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