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
- fill - Write a method that creates a new array with given values.
- reverse - Write a method that reverts input array.
- compact - Write a method that clears array from all unnecessary elements, like false, undefined, empty strings, zero, null.
- fromPairs - Write a method that returns an object composed of key-value pairs.
- without - Write a method that returns an array without listed values.
- unique - Write a method that returns a duplicate-free array.
- isEqual - Write a method that makes a shallow compare of two arrays and returns true if they are identical.
- flatten - Write a method that turns a deep array into a plain array.
- chunk - Write a method that splits an array into parts of determined size.
- 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
- isPlainObject - Write a method that verifies argument is a plain object, not an array or null
- makePairs - Write a method that returns a deep array like [[key, value]]
- without - Write a method that returns new object without provided properties
- isEmpty - Write a method that makes a shallow check is object empty
- isEqual - Write a method that makes a shallow compare of two objects
- invoke - Write a method that invokes an array method on a specific path
- isEmptyDeep - Write a method that makes a deep check is an object empty
- isEqualDeep - Write a method that makes a deep compare of two objects
- intersection - Write a method that finds shallow intersections of objects
- intersectionDeep - Write a method that finds all intersections of objects