mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-06 17:50:39 +08:00
Update keyFinder.js
optimized the indentation for the if statement in line 18
This commit is contained in:
@ -10,14 +10,14 @@ function keyFinder(){
|
|||||||
var str = document.getElementById("encryptedID").value; //get the input string
|
var str = document.getElementById("encryptedID").value; //get the input string
|
||||||
var inStr = str.toString(); //convert the input to String
|
var inStr = str.toString(); //convert the input to String
|
||||||
var outStr = ""; // store the output value
|
var outStr = ""; // store the output value
|
||||||
document.getElementById("debug").innerHTML = shiftNum;
|
document.getElementById("debug").innerHTML = shiftNum; // debug: display the shifted number(s)
|
||||||
for (var i=0; i<26; i++){
|
for (var i=0; i<26; i++){
|
||||||
outStr = caesarCipherEncodeAndDecodeEngine(inStr,i); // use the encrytpion engine to decrypt the input string, shiftNum=i
|
outStr = caesarCipherEncodeAndDecodeEngine(inStr,i); // use the encrytpion engine to decrypt the input string, shiftNum=i
|
||||||
for ( var i=0; i<wordbank.length; i++){
|
for ( var i=0; i<wordbank.length; i++){
|
||||||
if (wordbank[i] == outStr[i]+outStr[i+1]{
|
if (wordbank[i] == outStr[i]+outStr[i+1]{
|
||||||
key=i;
|
key=i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user