+ 3

[Solved] Help me with my small HTML/ JavaScript problem 😊

help me to add JavaScript code which takes the input from user, compares each character in the string entered by the user with inputString. If a character is present in the inputString, replace it with the respective character in the outputString. if the character is not present in the inputString, display it as it is in the output. Example: user input: A12? output should be: 🇦12? user input: BIBEK output should be: 🇧 🇮 🇧 🇪 🇰 My code: <script> function convert(){ var inputString=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']; var outputString=['🇦','🇧','🇨','🇩','🇪','🇫','🇬','🇭','🇮','🇯','🇰','🇱','🇲','🇳','🇴','🇵','🇶','🇷','🇸','🇹','🇺','🇻','🇼','🇽','🇾','🇿']; } // JS Code Here </script> <input type="text" id="input" placeholder="Input Field." /> <input type="button" id="button" value="Convert" onclick="convert()" /> <input type="text" id="output" placeholder="Output Field." />

16th Dec 2019, 6:03 PM
Bibek Oli
Bibek Oli - avatar
3 Respostas
16th Dec 2019, 7:36 PM
Daniel C
Daniel C - avatar
+ 1
First define a var that stores the user input
16th Dec 2019, 7:34 PM
Alfred Juma
Alfred Juma - avatar
+ 1
Daniel C thank you😍😍😊
17th Dec 2019, 2:07 AM
Bibek Oli
Bibek Oli - avatar