Docsity

JavaScript exercise questions, Assignments of Computer science

Partial preview of the text

Download JavaScript exercise questions and more Assignments Computer science in PDF only on Docsity!

Assignment # 12- JAVASCRIPT

IF…ELSE & ELSE IF STATEMENT,

TESTING SET OF CONDITIONS

  1. Write a program that takes a character (number or string) in a variable & checks whether the given input is a number, uppercase letter or lower case letter. (Hint: ASCII codes:- A=65, Z=90, a=97, z=122).
  2. Write a JavaScript program that accept two integers and display the larger. Also show if the two integers are equal.
  3. Write a program that takes input a number from user & state whether the number is positive, negative or zero.
  4. Write a program that takes a character (i.e. string of length 1) and returns true if it is a vowel, false otherwise
  5. Write a program that a. Store correct password in a JS variable. b. Asks user to enter his/her password c. Validate the two passwords: i. Check if user has entered password. If not, then give message “ Please enter your password” ii. Check if both passwords are same. If they are same, show message “Correct! The password you entered matches the original password”. Show “Incorrect password” otherwise.