MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / fun

Function fun

assets/js/palindrome.js:1–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1function fun() {
2 var val = document.getElementById("fld").value;
3 if (val == "") {
4 document.getElementById("result").innerHTML = "Type something !";
5 return false;
6 } else {
7 val=val.toLowerCase();
8 val = val.split("");
9 for (var i = 0; i < val.length; i++) {
10 if (val[i] == " ") {
11 val.splice(i, 1);
12 }
13 }
14 val = val.join("");
15 console.log(val);
16 var temp = val.split("").reverse();
17 for (var i = 0; i < temp.length; i++) {
18 if (temp[i] == " ") {
19 temp.splice(i, 1);
20 }
21 }
22 temp = temp.join("");
23 console.log(temp);
24 if (val == temp) {
25 document.getElementById("result").innerHTML = "Yup,It's a Palindrome !";
26 return false;
27 } else {
28 document.getElementById("result").innerHTML = "Oh,no it's not a Palindrome!";
29 return false;
30 }
31 }
32}
33
34function myFunction() {
35 document.getElementById("form").reset();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected