How do I take an array, modify it by moving each array number forward i places and if i is greater than 26 than subtract 26, and then displaying the array as it would be in plaintext.
http://jsfiddle.net/clarinetking/kLy83oxj/4/
var alphabet = [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 text;
$('#assign').click( function() {
text = $('#Input').val();
num = $('#Number').val();
});
$('#rotate').click( function() {
for(i=0;i<alphabet.length;i++) {
alphabet[i] = alphabet[i+num];
if (alphabet[i]>26){
i=i-26;
}
}
});
$('#solve').click( function() {
alphabet.toString();
$('#Output').append(alphabet);
});
It's kind of hard to explain. Sorry. It's basically a case of a caesar cipher i.e imagine a wheel of letters. Move the wheel i places clockwise and each letter has a new position in the alphabet. I'm trying to reverse this process.
OH by the way a lot of people ask why I only ever use html. Short answer, that's all I understand except some pascal :)