Skip to content

itstefanjanos/js-practices

Repository files navigation

js-practices

1. strings

  1. Returning Strings
  2. Highest and Lowest
  3. Positions Average

2. numbers

  1. Return Negative
  2. Thinkful - Number Drills: Congo warehouses
  3. Steps in Primes

3. numbers-and-strings

  1. Resistor Color Codes, Part 2

4. arrays

  1. Count of positives / sum of negatives
  2. Even numbers in an array
  3. Well of Ideas - Harder Version
  4. 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,
        }
    ]
    

5. context

  1. 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, ...).

  2. 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})

  3. 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].

6. prototype-and-classes

  1. Refactored Greeting
  2. The sortReloaded() method
  3. Build a Car

7. promises

  1. 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)}’);
    });
    
  2. 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)}’);
    });
    
  3. 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.

8. ES6+

  1. Unique In Order
  2. Duplicates. Duplicates Everywhere.
  3. Highest Rank Number in an Array
  4. "this" is an other problem

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published