Skip to content

Latest commit

 

History

History
54 lines (23 loc) · 1.99 KB

File metadata and controls

54 lines (23 loc) · 1.99 KB

JavaScript Second Assessment Review

Instructions

  1. Carefully read all the instructions and problems before beginning your work.

  2. Clone this repository to your local projects directory.

  3. Write your solutions to the problems presented below inside solutions.js.

Problems

  1. A farmer is asking you to tell him how many legs can be counted among all his animals. The farmer breeds three species:

    chickens = 2 legs

    cows = 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 named animal that returns the total number of legs of all the animals.

  2. Define a function named findPerimeter that takes in length and width and finds the perimeter of a rectangle.

  3. Define a function named concatName. Given two strings, firstName and lastName, return a single string in the format "last, first".

  4. Write a function named triArea that takes in 2 inputs, the base and height of a triangle and return its area.

  5. Define a function named lessThan100. Given two numbers, return true if the sum of both numbers is less than 100. Otherwise return false.

  6. Write a function named makesTen that takes two inputs. Both arguments are integers, a and b. Return true if one of them is 10 or if their sum is 10.

  7. You are counting points for a basketball game, given the amount of 2-pointers scored and 3-pointers scored, create a function named points that will find the final points for the team and return that value.

  8. Define a function named Convert that takes in minutes as an input and will converts those minutes into seconds.

  9. Write a function named remained that takes two numbers as inputs. The first parameter divided by the second parameter will have a remainder, possibly zero. Return that value.

  10. Write a function named getFisrtValue that takes an array containing only numbers and return the first element.

Js-first-assessment-review