Beginner JavaScript Exercises:
- Create a variable and store your name in it.
- Write a function that adds two numbers and returns the result.
- Display an alert with a greeting message.
- Use the
console.log
to print "Hello, World!" to the browser console. - Create an array of fruits and access a specific fruit by its index.
- Write a function that takes a number as an argument and returns whether it's even or odd.
- Use a for loop to print numbers from 1 to 10 in the console.
- Create an object representing a person with properties like name and age.
- Create a button that changes the text on a webpage when clicked.
- Implement a simple calculator that can perform basic operations (addition, subtraction, multiplication).
- Write a function to find the length of a string.
- Create an array of colors and display them as a list on a webpage.
- Use if-else statements to check if a number is positive, negative, or zero.
- Build a basic HTML form with text input and a submit button.
- Develop a simple rock-paper-scissors game that can be played in the browser console.
Intermediate JavaScript Exercises:
- Create a function to reverse a string without using built-in methods.
- Build a to-do list application that allows adding, deleting, and marking tasks as completed.
- Develop a basic quiz application with multiple-choice questions and a scoring system.
- Implement a countdown timer that triggers an action when it reaches zero.
- Build a simple image carousel that allows users to navigate through a set of images.
- Create a program that generates a random password with customizable length and complexity.
- Develop a weather app that fetches and displays current weather data using an API.
- Write a function to search and filter an array of objects based on specific criteria.
- Implement a responsive navigation menu that changes appearance on smaller screens.
- Create a form validation script that checks user input and provides feedback.
- Build a basic chat application with real-time messaging using WebSockets.
- Develop a small e-commerce shopping cart with product listings, a shopping cart, and checkout functionality.
- Implement user authentication and secure password storage for a web application.
- Create a memory card game with a grid of cards that the player can match.
- Build a simple calculator that can handle more complex operations like square root and exponentiation.
Junior JavaScript Developer Interview Questions:
- What are the basic data types in JavaScript?
- Explain the difference between
null
andundefined
in JavaScript. - How do you handle asynchronous operations in JavaScript, and what are Promises?
- Can you describe the concept of scope and how it works in JavaScript?
- What is a closure in JavaScript, and provide an example of its use.
- How would you iterate through the properties of an object?
- Explain the difference between
let
,const
, andvar
in variable declaration. - How can you avoid callback hell (callback pyramid) when working with asynchronous code?
- What is the purpose of the
this
keyword in JavaScript, and how does it behave in different contexts? - What are arrow functions, and how do they differ from regular functions?
These questions can help you demonstrate your understanding of JavaScript fundamentals and development practices.