Conditionals
10 JavaScript conditionals challenges, each with test cases you can run in the browser.
- isEven — Easy. Given a number, return true if it is even, otherwise return false.
- isLeapYear — Easy. Given a year, return true if it is a leap year, otherwise return false. A leap year is a year which is divisible by 4, except for end-of-cen
- checkSign — Easy. Given a number, return 'positive' if the number is greater than 0, 'negative' if it's less than 0, and 'zero' if it is 0.
- inRange — Easy. Given a number and a range (lower and upper bounds), return true if the number is within the range (inclusive), and false otherwise.
- getGrade — Easy. Write a function that returns a letter grade (A, B, C, D, F) for a given numerical score. Use the standard grading scale: 90-100 is A, 80-89
- canVote — Easy. Given a person's age, determine if they are old enough to vote. The voting age is 18.
- maxOfThree — Easy. Given three numbers, return the largest one.
- isTriangle — Easy. Given three integer side lengths, determine if they can form a valid triangle. According to the triangle inequality theorem, the sum of the
- ticketPrice — Easy. Calculate the price of a movie ticket based on age. The prices are: Child (age <= 12) is $10, Adult (age 13-59) is $15, and Senior (age >= 6
- dayOfWeek — Easy. Given a number from 1 to 7, return the corresponding day of the week ('Sunday' for 1, 'Monday' for 2, etc.). If the number is out of range,