Question: JavaScript Can Validate Input Please input a string that is a palindrome: Submit function myFunction() { var x, text; //Get the value of the input
JavaScript Can Validate Input
Please input a string that is a palindrome:
function myFunction() {
var x, text;
//Get the value of the input field id="numb"
x = document.getElementById("WEBT2300").value;
// If x is Not a String and not a palindrome
{
}
else
text = "Input OK";
}
document.getElementById("WEBT2300").innerHTML = text;
}
if (!isNaN(x) || x > 'd' || x < 'm') {
text = "Input not valid";
} else {
// text is ok
text = "Input OK";
}
Question 12 options:
|
| function Palindrome(str) { return str == str.split('').reverse().join(''); } |
|
| function Palindrome(str) { return str == str.split('').join(''); } |
|
| function checkPalindrome(str) { return str != str.split('').reverse().join(''); } |
|
| function checkPalindrome(str) { return str == split('').join(''); } |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
