Skip to content

Basic Functions Labs

Resources for this lab: resources/labs/basicFunctions

1 : Write a function named reverse ...

This function will take one argument, a string.

Return the submitted string with the characters in reverse order.

2 : Write a function named palindromeChecker ...

This function will take one argument, a string.

If the provided string is a palindrome (the same backwards and forwards), return true, otherwise return false.

3 : Write a function named isPrime ...

This function will take one argument, a whole number.

If the provided number is prime, return true, otherwise, return false.

4 : Write a function named computeTax ...

This function will take one or two arguments.

  • The first argument will always be the amount tendered.

  • The second argument, which is optional, could be the tax percentage (as a whole number). If no second argument is provided, assume the tax rate is 7.5%.

Once applying the correct amount of tax, return the amount of tax owed.


Prev -- Up