words = [
"January",
"lacks",
"caveats",
"hazardous",
"DOORS",
"crying",
"arrogantly",
"climate",
"proponent",
"rebuttal"
]; // answer Has to be JavaScript
// i can only get it right till JavaS
function decode(words){
for(i=0;i<words.length;i++){
msg = words[i].charAt(i);
while(i>6 && i<=words.length){
j=0;
msg = words[i].charAt(j);
j++;
}
console.log(msg);
}
}
decode(words);
J
a
v
a
S
g
n
t
对于第一个单词,抓住第一个字符,对于第二个单词,第二个字符,依此类推。当你到达第六个单词时,从第一个字符开始。
%
为您提供i除以5的余数。
0%5=0,1%5=1。。。,5%5=0等等。
function decode(words){
for(i=0;i<words.length;i++){
msg = words[i].charAt(i%5);
console.log(msg);
}
}