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

154
Views
Why is the default value being selected every time?

Hi im new to programming.

The variable age = 4 should output "You get an allowance" but the switch statement keeps going to default?

<script>

var age = 4;

switch (age){
    case (age> 65):
    document.write("you get your income from your pension")
    break;

    case (age < 18):
    document.write("you get an allowance")
    break;

    case( 18<age<=65):
    document.write("each month you get a salary")
    break;

    default:
    document.write("The value of the age variable is not numerical")
    break;
}

</script>
about 4 years ago · Santiago Gelvez
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!