Javascript practice

I prepared javascript exercises, which I hope will help you to improve your coding skills. I do not affirm my solutions are the best ways to solve each of the exercises, but I believe they could help you to find some new ideas if you stuck.

Prerequisites

npm i to install jest and lint

Exercises with arrays

To run check your solutions use npm run testArrays.
Also, you can check mine by running npm run testArraysSolutions.

List of tasks

  1. fill - Write a method that creates a new array with given values.
  2. reverse - Write a method that reverts input array.
  3. compact - Write a method that clears array from all unnecessary elements, like false, undefined, empty strings, zero, null.
  4. fromPairs - Write a method that returns an object composed of key-value pairs.
  5. without - Write a method that returns an array without listed values.
  6. unique - Write a method that returns a duplicate-free array.
  7. isEqual - Write a method that makes a shallow compare of two arrays and returns true if they are identical.
  8. flatten - Write a method that turns a deep array into a plain array.
  9. chunk - Write a method that splits an array into parts of determined size.
  10. intersection - Write a method that creates an array of unique values that are included in all given arrays.

Exercises with objects

To run check your solutions use npm run testObjects.
Also, you can check mine by running npm run testObjectsSolutions.

List of tasks

  1. isPlainObject - Write a method that verifies argument is a plain object, not an array or null
  2. makePairs - Write a method that returns a deep array like [[key, value]]
  3. without - Write a method that returns new object without provided properties
  4. isEmpty - Write a method that makes a shallow check is object empty
  5. isEqual - Write a method that makes a shallow compare of two objects
  6. invoke - Write a method that invokes an array method on a specific path
  7. isEmptyDeep - Write a method that makes a deep check is an object empty
  8. isEqualDeep - Write a method that makes a deep compare of two objects
  9. intersection - Write a method that finds shallow intersections of objects
  10. intersectionDeep - Write a method that finds all intersections of objects