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

192
Views
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 answers
Answer question

0

I think this image will give you the idea.

about 4 years ago · Juan Pablo Isaza Report

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 Report
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!