/basic-javascript

practice writing functions

Primary LanguageJavaScript

Javascript Fundamentals Part I

  1. Fork and clone this repository
  2. In the root directory of this folder, run npm install
  3. Add the necessary code in script.js for each function
  4. Run npm test to run the tests
  5. Once the tests pass you are all done!

Problems

  1. Define a function called difference that takes two numbers as arguments and returns their difference.
  2. Define a function called isEqual that takes two arguments and returns a boolean. Return true if the two arguments are equal and return false if they are not.
  3. Define a function called isEven that takes an arbitrary whole number as an argument and return a boolean. Return true if the number is even and false if it is not.
  4. Define a function called isDivisible that takes two arguments and returns a boolean. Return true if the first argument is divisible by the second; otherwise, return false.
  5. Define a function called discountPercentage that returns the total discount ($), given the original amount and discount percentage (as arguments). Return a warning that says "please enter a number between 0 and 100" if the discount amount is greater than 100 or less that 0 percent.
  6. Define a function called isVowel that takes a letter and returns true if the letter is a vowel, and false if the letter is a consonant. (Treat 'y' as a consonant)
  7. Write code that converts a temperature in Celsius to Fahrenheit.
  8. Define a function called biggestOfThree which takes three numbers as arguments, and returns the largest one.
  9. Bonus: Write a function that will estimate your federal income taxes. The function should take just one input: your salary (or future salary, once you graduate!). The link below has information on how federal income taxes are calculated:

Federal Income Tax Brackets