📄️ Conditions
A basic condition in javascript is,
📄️ pH calculator
Complete the function findpH such that it returns base when pH is above 7 and acid in all other cases.
📄️ Advanced if
It is sometimes possible to drop the else. Consider the following example,
📄️ Get next year II
Complete the function getNextYear such that it returns next year(adding 1 to current year) and fix the function return NaN.
📄️ Text app III
Complete the function getText such that it returns the first 10 characters followed by 3 dot characters of the text received. When the text is 10 characters or less, 3 dot character should not be used.
📄️ Returning booleans
It's unnecessary to use if and else when returning a boolean (true or false).
📄️ Pass mark
Complete the function toPass such that it returns true when mark is above 45 and false in all other cases. You should not use an if condition (or ternary).
📄️ Even and Odd
We discussed the Remainder operator(%) in the Numbers chapter. When you divide a number by two, the division remainder is either 0 or 1. This will assist you in determining whether the original number is even (divisible by two without a remainder) or odd.
📄️ Check even or odd
Complete the function isEvenOrOdd such that it returns the string "Even" if given number is even and "Odd" otherwise.