/js-challenges

🏆A collection of Javascript coding challenges, from beginner to advanced.

Primary LanguageJavaScript





logo

Some javascript challenges from beginner to advanced.




Index

What?

A collection of Javascript coding challenges, from beginner to advanced. All challenges are taken from the generous web or created by the contributors.

So, Why?

I'm creating this repo because I want to bring as many as possible code challenges (for free obviously) in a file or more. I know that there are so many websites like codewars or coderbyte but this is different. So many websites are not for free, you need to pay a subscription.

Challenges

Below a few challenges, you can get the full documentation here.

If you have an idea on how to improve this repo don't be shine, post a PR o open a new ISSUE!

  1. ROUND NUMBER

    • NAME: round
    • DESCRIPTION: Write a function that round a number to given decimal places.
    	round(Math.PI, 2); // => 3.14 
  2. MERGE MULTIPLE ARRAYS

    • NAME: arrayMerge
    • DESCRIPTION: Write a function that merges multiple given arrays.
    	arrayMerge([1, 2], [3, 4]); // => [1, 2, 3, 4]
  3. SUM CONTENT OF AN ARRAY

    • NAME: arraySum
    • DESCRIPTION: Write a function to sum the content of an array.
    	arraySum([1, 2, 3]) // => 6
  4. OBJECT FOREACH

    • NAME: objectForEach
    • DESCRIPTION: Write a forEach function that works with Objects.
    	var obj = {
    		first_name: 'Elon',
    		last_name: 'Musk'
    	}
    
    	objectForEach(obj, (key, value) => {
    		console.log(key, value) 
    	})
    
    	//=> 'first_name', 'Elon'
    	//=> 'last_name', 'Musk'
  5. STRING REVERSE

    • NAME: reverseString
    • DESCRIPTION: Write a function that reverse a string.
    	reverseString('hello world!') //=> '!dlrow olleh'

Participating

  1. Clone this repo
  2. Install all dependencies via npm install.
  3. Fill all challenges in ./src/challenges.js.
  4. Test them via npm run test.
  5. Some ideas? Submit a PR or open an ISSUE!

Contributing

  1. Clone this repo.
  2. Install all dependencies via npm install.
  3. Write down your challenge (with solution) in ./src/challenges.js.
  4. Write a test for your challenge in ./test/_your-challenge.js.
  5. Import your test in the test.js file.
  6. Test your challenge via npx ava ./test/_your-challenge.js.
  7. Move your solution to ./src/solutions.js.
  8. Submit your PR!

Contributing notes

All challenges need to follow this scheme:

(2 spaces between each challenge)

    /** 
     * CHALLEBGE <n>: <CHALLENGE-NAME>
     * @name <functionName>
     * @description <challenge-description>
     * @author <Your Name> <you[at]domain.com>
     * 
     * 
     * @example Usage:
     * functionName(args) //=> output
     * 
     * 
     * @param {Type} a ...
     * @param {Type} b ...
     * 
     * @returns {Type} ... 
    */
    module.exports.challenge_name = function() {}

If your challenge is taken from forums please link the thread or the stackoverflow question with @see

READ MORE ABOUT JSODC here

Related


TwitterInstagramGitHub