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);
&#13;
J
a
v
a
S
g
n
t
对于第一个单词,抓住第一个字符,第二个字,第二个字符,依此类推。当你到达第6个单词时,再次从第1个单词开始。
答案 0 :(得分:0)
%
为你提供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);
}
}