how to create an encoder and decoder in javaScript
var x = prompt("Select your desired option \n 1) Encode \n 2) Decode \n ", +x);
var choice = parseInt(x);
var str;
switch (choice) {
case 1:
str = prompt("Enter words to be encoded: \n " + str);
var encodedStr = btoa(str);
alert(encodedStr);
break;
case 2:
str = prompt("Enter words to be decoded: \n " + str);
var decodedStr = atob(str);
alert(decodedStr);
break;
}
str = undefined;
//Taizya was here