Photo by Antonio Batinić/ Pexels
If you want to learn JavaScript, there are many methods you can employ. You can find some of these in the article linked and another article about JavaScript flashcards.
But a lot of beginners struggle to move from theory to practice. For that purpose I've prepared 20 JavaScript exercises. These are divided into three sections: basic, medium and advanced. That way you can finish them one by one, and take more and more complicated problems to solve. Let's go:
Basic
- Write an app that converts units from kilometers to miles
- Write a tik-tak-toe game
- Write an app that displays a table with surname, name, and age. Data should be stored in an array of objects
- Create a car object that offers an information about model, year of production and method to start it and stop. Expose these information and methods in a visual interface
- Create a basic 2D game, where you can move a character on the screen with the arrow keys
Medium
- Write an app that displays tabular data fetched from an API
- Create a car object that offers an information about model, year of production and method to start it and stop. Expose an interface that allows you to see and manage cars, and to create and remove cars
- Create a mockup array with temperature readings, where there is one temperature reading per day for a period of one year. Create an interface that displays a graph with these readings
- Find an API that delivers weather data. Based on these information display the temperature, humidity and cloudiness. Display visual icons based on the level of these parameter. For example for cloudiness: sun, partially cloudy and cloudy icons. The information should be updated in near real-time.
- Create a 2D game with a 20x20 field, a character and randomly placed obstacles. The character should move in a random direction every second. If it will hit an obstacle, it should start the game from start. Visualize the game on the screen.
- Write an app that allows people to paste a text. The app detects it and calculates following numbers: numer of characters, words, average length of a word. Numbers should be presented with proper decimal and thousand separators.
Advanced
- Write an app that converts dollars to euro using an API that delivers the current exchange rate
- Write a tik-tak-toe game that you can play with someone through the internet
- Create a mockup array with temperature readings, where there is one temperature reading per day for a period of one year. Create an interface that displays a graph with these readings, min, max and average temperature
- Choose a payment provider and implement a payment method in a way that the visitor is asked to make a payment. Once he does it, he gets an access to a wallpaper he can download