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
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]);
}
Comments
Leave a comment