Answer to Question #258763 in HTML/JavaScript Web Application for ammar

Question #258763

Write a program that asks the user for a two digit number. Your program will verify that the number is two digits. If it is, display the first digit on one line and the second digit on another line. Otherwise, give a warning message to the user that the entry wasn’t correct. Only java script plz


1
Expert's answer
2021-10-30T03:13:29-0400


let number = prompt("Enter a two digit number: ");
if(isNaN(number) || number.length!=2){
	console.log("The entry wasn't correct");
 }else{
     console.log("First digit: "+number[0]);
	 console.log("Second digit: "+number[1]);
 }

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS