/js-23

javascript

Primary LanguageJavaScript

JS WarmUp Submission

  1. Write a function called "addFive". Given a number, "addFive" returns 5 added to that number.
  2. Write a function called "getOpposite". If the given value is an integer, return its opposite value, otherwise return -1
  3. Fill in your code that takes an number minutes and converts it to seconds.
  4. Create a function that takes a string and returns it as an integer.
  5. Create a function that takes a number as an argument, increments the number by +1 and returns the result.
  6. Create a function that takes an array and returns the first element.
  7. Write a function that converts hours into seconds.
  8. Create a function that takes height and width and finds the perimeter of a rectangle.
  9. Given two numbers, return true if the sum of both numbers is less than 100. Otherwise return false. 10.There is a single operator in JavaScript, capable of providing the remainder of a division operation. Two numbers are passed as parameters. The first parameter divided by the second parameter will have a remainder, possibly zero. Return that value.
  10. MacDonald is asking you to tell him how many legs can be counted among all his animals. The farmer breeds three species: turkey = 2 legs horse = 4 legs pigs = 4 legs The farmer has counted his animals and he gives you a subtotal for each species. You have to implement a function that returns the total number of legs of all the animals. 12.Create a function that returns the number of frames shown in a given number of minutes for a certain FPS.
  11. Create a function that returns true if an integer is evenly divisible by 5, and false otherwise.
  12. Write a function called "isEven". "isEven" Should return whether it is even or not. Return -1 for invalid input
  13. Given a first and a last name, "getFullName" returns a single string with the given first and last names separated by a single space.
  14. Given a word, "getLengthOfWord" returns the length of the given word.
  15. Given two words, "isSameLength" returns whether the given words have the same length.
  16. Create a function to calculate the distance between two points defined by their x, y coordinates.
  17. Given an array and an integer, "getNthElement" returns the element at the given integer, within the given array. If the array has a length of 0, it should return ‘undefined’. 20.Given an array, "getLastElement" returns the last element of the given array. If the given array has a length of 0, it should return '-1'. 21.Given an object and a key, "getProperty" returns the value of the property at the given key. If there is no property at the given key, it should return null.
  18. Given an object and a key, "addProperty" adds a new property on the given object with a value of true.
  19. Given an object and a key, "removeProperty" removes the given key from the given object.