forked from khushi-purwar/WebDev-ProjectKart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAscii.js
37 lines (25 loc) · 956 Bytes
/
Ascii.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const txtInput = document.querySelector(".inputs input"),
checkBtn = document.querySelector(".inputs button"),
infoTxt = document.querySelector(".info-txt");
let filterInput;
checkBtn.addEventListener("click", () => {
let n = filterInput;
console.log(typeof n);
console.log(n.codePointAt(0));
let asc=n.codePointAt(0);
//console.log(isFibonacci(n));
infoTxt.style.display = "block";
// if(isString(n)===true){
// return infoTxt.innerHTML = `Enter a valid input`
// }
// else{
return infoTxt.innerHTML = `ASCII Value of <span>'${txtInput.value}'</span> is <span>'${asc}'</span>`;
});
txtInput.addEventListener("keyup", () => {
filterInput = txtInput.value.toLowerCase().replace(/[^A-Z0-9]/ig, "");
if(filterInput) {
return checkBtn.classList.add("active");
}
infoTxt.style.display = "none";
checkBtn.classList.remove("active");
});