My current challenge involves converting text into numbers using code. Here is the code snippet I have:
var vals= ["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","0","1","2","3","4","5","6","7","8","9"," ",",",".","!","?","/","\\","#","@","=","-","_",":"];
var input = prompt("Input:");
var inn = input.toLowerCase + "";
var ins = inn.split("");
var pswrd = prompt("Password(LowerCase):")
var pin = pswrd.toLowerCase + "";
var pins = pin.split("");
var out = "";
var i;
var mul = Math.floor((Math.random() * 30) + 1);
for(i=0;i<ins.length;i++){
var num = ins[i]
var val = vals.indexOf(num)
var out = out+val*mul+" "
}
var out = out+"ↀ"
for(i=0;i<pins.length;i++){
var num = pins[i]
var val = vals.indexOf(num)
var out = out+val*mul+" "
}
alert('Result:' + out);
Despite my efforts, when I run the code with the input "Hello" and password "hi", I get an unexpected output:
Input: Hello
Password: hi
Output: 50 200 130 20 190 80 140 130 360 190 140 -10 140 220 40 170 -10 0 180 40 -10 -10 360 -10 360 -10 130 0 190 80 210 40 360 20 140 30 40 -10 360 -10 ↀ50 200 130 20 190 80 140 130 360 190 140 -10 140 220 40 170 -10 0 180 40 -10 -10 360 -10 360 -10 130 0 190 80 210 40 360 20 140 30 40 -10 360 -10
I'm in need of help to understand the issue. Any assistance would be greatly appreciated. Thank you!