JavaScript Practice Exercise

Since JavaScript is one of the popular languages for coding, learners should practice it by writing some code. These beginner-level level JavaScript Practice Exercise questions help them learn the language.

JavaScript Practice Exercise

  1. Use JavaScript to display pop up boxes (alert box, an alert box with line breaks, confirm box, prompt box)
  2. Use JavaScript to call a function with an argument that returns a value.
  3. Create a web page to demonstrate Java Script events.
  4. Create a web page to demonstrate Java Script Exception handling.•          
  5. Write a JavaScript to accept your name and display it.
  6. Write a JavaScript code to accept 10 numbers and check how many are +ive,  -ive, and zero.
  7. Write a Program in JavaScript to find the factorial of a number between 1 to 10

       Output should be like as given below: –

Factorial   of   1 is: 1

Factorial of    2 is:  2




factorial  of  10 is :   

  • Write a Program in  JavaScript to find the reverse of a digit.
  • Write a JavaScript code block, which greets a user with a message Welcome’. When a user leaves this page, the ‘Good-bye’ alert dialog box is displayed
  • Write a script that displays the various Math & String Functions.   
  • Create a student registration form and show the form details. After clicking on submit button following validations must be performed:
    • Clear the previous value when a field is selected.
    • Display warning message when a field is left blank.

Perform validation on some field against a specified range (onchange event).

  • Create a web page that uses JavaScript to change the content of a paragraph.
  • Write a JavaScript program using a function that adds and removes a bulleted list with the click of buttons.
  • Create a web page with input validation using JavaScript.
  • Write a JavaScript function that finds both minimum and maximum from an array.
  • Create a JavaScript function to sort elements of an array.
  • Perform Linear Search and Binary search using JavaScript.
  • Demonstrate the use of Arrow functions in JavaScript.
  • Find the area of a circle using an anonymous function in JavaScript.
  • Change the background color of a paragraph randomly using JavaScript.

Related Topics

Evolution of JavaScript from ES1 to ES2020

Understanding Document Object Model (DOM) in JavaScript

Introduction to Programming in TypeScript

Creating Classes in TypeScript

Working with Arrays in TypeScript

Significance of Tuples in TypeScript

Explaining Interfaces in TypeScript with Examples

How to Create and Use Arrow Functions in TypeScript

Understanding JSON Web Tokens

Leave a Reply

Your email address will not be published. Required fields are marked *