r/learnjavascript • • Jun 15 '19

50 micro coding challenges for JavaScript learners

231 Upvotes

This is a list of 50 micro coding challenges intended for beginners that just learned the basis of JavaScript language. Solve them to improve or test your coding skills and language understanding.

Although the challenges are designed for codeguppy.com learners, the challenges are platform agnostic so any JavaScript beginner can have fun with them.

What coding environment to use?

We recommend using an online JavaScript coding environment that allows you to share your code with others if you decide so. codeguppy.com is one option, but any other online JavaScript playground will work just fine.

Coding challenges

  1. Print numbers from 1 to 10.Note: If you are using codeguppy.com, use can use the the println() function to print directly on the screen, otherwise use console.log() to output in the browser console.

  2. Print the odd numbers less than 100

  3. Print the multiplication table with 7

  4. Print all the multiplication tables with numbers from 1 to 10

  5. Calculate the sum of numbers from 1 to 10

  6. Calculate 10!

  7. Calculate the sum of even numbers greater than 10 and less than 30

  8. Calculate the sum of numbers in an array of numbers

  9. Calculate the average of the numbers in an array of numbers

  10. Create a function that receives an array of numbers as argument and returns an array containing only the positive numbers

  11. Find the maximum number in an array of numbers

  12. Print the first 10 Fibonacci numbers without recursion

  13. Create a function that will find the nth Fibonacci number using recursion

  14. Create a function that will return a boolean specifying if a number is prime

  15. Calculate the sum of digits of a positive integer number

  16. Print the first 100 prime numbers

  17. Create a function that will return in an array the first “p” prime numbers greater than “n”

  18. Rotate an array to the left 1 position

  19. Rotate an array to the right 1 position

  20. Create a function to reverse an array and return the result as a new array

  21. Create a function that will merge two arrays and return the result as a new array

  22. Create a function that will receive two arrays of numbers as arguments and return an array composed of all the numbers that are either in the first array or second array but not in both

  23. Create a function that will receive two arrays and will return an array with elements that are in the first array but not in the second

  24. Create a function that will receive an array of numbers as argument and will return a new array with distinct elements

  25. Calculate the sum of first 100 prime numbers and return them in an array

  26. Print the distance between the first 100 prime numbers

  27. Create a function that will add two positive numbers of indefinite size. The numbers are received as strings and the result should be also provided as string.

  28. Create a function that will return the number of words in a text

  29. Create a function that will capitalize the first letter of each word in a text

  30. Calculate the sum of numbers received in a comma delimited string

  31. Create a function that returns the number of occurrences of each word inside a text. The return will be an array with objects inside {word, count}

  32. Create a function to convert a CSV text to a “bi-dimensional” array

  33. Create a function that converts a string to an array of characters

  34. Create a function that will convert a string in an array containing the ASCII codes of each character

  35. Create a function that will convert an array containing ASCII codes in a string

  36. Implement the Caesar cypher as a single function encryptDecrypt(text, key);

  37. Implement the bubble sort algorithm for an array of numbers

  38. Create a function to calculate the distance between two points defined by their x, y coordinates

  39. Create a function that will return a Boolean value indicating if two circles defined by center coordinates and radius are intersecting

  40. Create a function that will receive a bi-dimensional array as argument and a number and will extract as a unidimensional array the column specified by the number

  41. Create a function that will convert a string containing a binary number into a number

  42. Create a function to calculate the sum of all the numbers in a jagged array (contains numbers or other arrays of numbers on an unlimited number of levels)

  43. Find the maximum number in a jagged array of numbers or array of numbers

  44. Deep copy a jagged array with numbers or other arrays in a new array

  45. Create a function to return the longest word in a string

  46. Shuffle an array of strings

  47. Create a function that will receive n as argument and return an array of n random numbers from 1 to n. The numbers should be unique inside the array.

  48. Find the frequency of letters inside a string. Return the result as an array of arrays. Each subarray has 2 elements: letter and number of occurrences.

  49. Calculate Fibonacci(500) with high precision (all decimals)

  50. Calculate 70! with high precision (all decimals)

Have fun… and don’t forget to share your solutions or comment about your progress. If you are a Twitter user, you can also tweet about your progress with hashtag #codeguppychallenge


r/learnjavascript • • Mar 08 '21

How to Build a Space Invaders Clone in JavaScript

Thumbnail
youtube.com
230 Upvotes

r/learnjavascript • • May 27 '20

JavaScript is now 25 years old.

Post image
230 Upvotes

r/learnjavascript • • Feb 04 '21

A collection of amazing free JavaScript resources.

Thumbnail
java5cript.com
228 Upvotes

r/learnjavascript • • Jul 31 '21

I used vanilla JavaScript to build a point & shoot game with collision detection by colour and other gamedev techniques (source code included)

227 Upvotes

r/learnjavascript • • Jul 09 '23

Full-stack devs be like

Post image
226 Upvotes

r/learnjavascript • • Jul 03 '22

My first project!

226 Upvotes

r/learnjavascript • • Apr 27 '20

Play snake by moving your head: face mesh detection in the browser with TensorFlow.js

226 Upvotes

r/learnjavascript • • Aug 30 '22

I developed a Pokémon version of the Hangman game

Post image
223 Upvotes

r/learnjavascript • • Aug 16 '20

Gitutor: A command line app that makes Git easy

223 Upvotes

r/learnjavascript • • Mar 05 '22

Sudoku Solver using SolidJS & Tailwind

222 Upvotes

r/learnjavascript • • May 03 '20

[RECOMMENDATION] Fullstackopen.com Will Knock Tutorial Hell Out Of You

221 Upvotes

I'm currently in part 4 of the course and so far, i've built a few basic web apps with React, Node, and MongoDB.

I started learning to code in late 2017 and up until yesterday, i didn't know how to deploy a node app to heroku or do unit tests or integrarion tests. But that's just a few things i've learned so far and i plan to continue next weekend.

So, if like me, you know basic or intermediate JavaScript, you know basic git and GitHub, but you've been stuck in tutorial hell or you're clueless about:

  • Connecting a React App to a Node backend

  • Database administration

  • Testing

  • Graphql

  • Typescript, or;

  • ACTUALLY BUILDING SOMETHING FROM WHAT YOU'VE LEARNT

I think that course will do you some good.


r/learnjavascript • • Jan 19 '23

How to start a client-side download with JavaScript

Post image
220 Upvotes

r/learnjavascript • • Oct 22 '20

I have just started learning JS and I already want to cry.

220 Upvotes

Yesterday I kept swearing at the monitor telling myself I'm too dumb to become a programmer while trying to figure out why my code woudln't work and I'm just at the start of my journey, I'm sure there are people who can relate out there hopefully.

EDIT: Thank you for the wholesome answers, I really needed them. I just needed to vent and I didn't expect so much support, I wish you all the best!


r/learnjavascript • • Sep 06 '20

I made a simple express server from my android phone with Termux and everyone in the lan can connect to my "mobile server"

Post image
220 Upvotes

r/learnjavascript • • Jun 23 '20

I Tried Making a 3D Game in JavaScript

Thumbnail
youtu.be
220 Upvotes

r/learnjavascript • • Mar 10 '22

Can someone explain why this prints only 5?

Post image
219 Upvotes

r/learnjavascript • • Oct 31 '21

My 3D resume using ThreeJS: Feedback please! (link in comments)

Post image
219 Upvotes

r/learnjavascript • • Jul 16 '21

Javascript Basic Types

Thumbnail
gallery
219 Upvotes

r/learnjavascript • • Aug 21 '20

In-depth 14 hour Fullstack React/GraphQL/TypeScript Tutorial

Thumbnail
youtube.com
218 Upvotes

r/learnjavascript • • May 30 '20

I Turned A Raspberry Pi Into A Node.js Web Server

Thumbnail
youtube.com
217 Upvotes

r/learnjavascript • • Jan 09 '21

I created a simple chat app with React, TailwindCSS, Node, and Socket.io! Started using the basic overview available on socket.io. IMHO, easy to use and understand. :)

Post image
216 Upvotes

r/learnjavascript • • May 12 '22

Created this using JavaScript. For code check the comments, lmk if you have any doubt.

215 Upvotes