Created
July 25, 2022 09:57
-
-
Save modos/7618efcc31e88c5f23ac9dd8be992a30 to your computer and use it in GitHub Desktop.
چنتا نقطه داره؟
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.querySelector(".btn").addEventListener("click", () => { | |
let inputText = document.querySelector(".input").value; | |
let result = 0; | |
for (let i = 0; i < inputText.length; i++) { | |
if (inputText.charAt(i) === "ی" && inputText.charAt(i + 1) !== "" && inputText.charAt(i + 1) !== " " && inputText.charAt(i + 1) !== undefined) { | |
result += 2; | |
} | |
if (obj[inputText.charAt(i)] !== undefined) { | |
result += parseInt(obj[inputText.charAt(i)]) | |
} | |
} | |
document.querySelector('.result').innerText = result; | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment