Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function main(){
  2.     const wordString = document.querySelector("#testWord").value;
  3.     document.querySelector("#wordResult").value = wordCheck(wordString);
  4. }();
  5.  
  6.  
  7. function wordCheck(inputString) {
  8.   //check asterisk
  9.   temp = "";
  10.   if (inputString.indexOf("*") != -1) {
  11.     temp = inputString.replace("*", "");
  12.   }
  13.   //check '@'
  14.   else if (word.indexOf("@") != -1) {
  15.     word = `*${word}*`;
  16.     temp = word;
  17.   }
  18.   //C '₪'
  19.   else if (word.indexOf("₪") != -1) {
  20.     temp = word.replace("₪", "new shekel");
  21.   }
  22.  
  23.     return temp;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement