- Count of positives / sum of negatives
- Even numbers in an array
- Well of Ideas - Harder Version
- To create a function that returns a string with cities names, split by comma(‘,’). These cities should be written in the next order: from cities with the smallest population to the biggest. Also, only cities with a population of more than 200000 should be shown.
const cities = [ { city: 'New-York', population: 1000000, }, { city: 'Kyiv', population: 230000, }, { city: 'Warsaw', population: 195000, }, { city: 'Paris', population: 403434, }, { city: 'Budapest', population: 326154, } ]
-
implement your own bind function. You will already know how to do this using prototypes. So it should be used like this randomFunction.ownBind(obj, ...).
-
Also I want you to implement own map function, which behaves like array method 'map'. It can be used like this [1, 2].ownMap((item, index, arr) => {...do something})
-
And the last one is to create an array method removeDuplicates, which should work like this: [1, 2, 2, 3, 2, 1, 4, 2, 4, 3, 5].removeDuplicates() // returns a new array [1, 2, 3, 4, 5].
-
The goal is to implement function “all” that will work in the same way original function Promise.all works. The usage of original Promise.all for implementation is forbidden.
Usage Example:
all([promise1, promise2, promise3]).then((results) => { console.log(‘All promises resolved. Results are - ${JSON.stringify(results)}’); });
-
The goal is to implement function “race” that will work in the same way original function Promise.race works. The usage of original Promise. race for implementation is forbidden.
Usage Example:
race([promise1, promise2, promise3]).then((result) => { console.log(‘A promised resolved! Result is- ${JSON.stringify(result)}’); });
-
Create a function, which will get an unknown number of URLs and:
a. Will make a request to each URL simultaneously and will return an array of responses. In case some request will return an error, the whole function should return an error.
[positiveResponse, positiveResponse] || error
b. Will make a request to each URL simultaneously and will return an array of responses. In case some request will return an error, this error should be written in the array of responses.
[positiveResponse, error]
x. Will make a request each by each only when the previous request is finished. Returns the last response or error
Usage of Promise methods is allowed in this case.