Skip to content
This repository has been archived by the owner on May 29, 2023. It is now read-only.
/ js-challenges Public archive

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

Notifications You must be signed in to change notification settings

rawnly/js-challenges

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation





logo

Some javascript challenges from beginner to advanced difficulty.




Index

What?

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

So, Why?

I'm creating this repo because I want to compile as many coding challenges (for free obviously) in one file. I know that there are many websites like codewars or coderbyte but this is different. These websites may not be free and you may need to pay a subscription.

Challenges

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

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

  1. ROUND NUMBER

    • NAME: round
    • DESCRIPTION: Write a function that rounds a number to given amount of 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 reverses 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. Share the challenge on twitter via #jschallenges
  6. Some ideas? Read below the contributing paragraph 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