非常に初心者の質問で申し訳ありませんが、これは私を怒らせています。
一言あります。単語の文字ごとに、1つの配列内の文字位置が検出され、並列配列内の同じ位置にある文字が返されます(基本暗号)。これは私がすでに持っているものです:
*array 1 is the array to search through*
*array 2 is the array to match the index positions*
var character
var position
var newWord
for(var position=0; position < array1.length; position = position +1)
{
character = array1.charAt(count); *finds each characters positions*
position= array1.indexOf(character); *index position of each character from the 1st array*
newWord = array2[position]; *returns matching characters from 2nd array*
}
document.write(othertext + newWord); *returns new string*
私が抱えている問題は、現時点では、関数が新しい単語の最後の文字だけを書き出すことです。document.writeにさらにテキストを追加したいのですが、forループ内に配置すると、新しい単語だけでなく、各単語の間にある他のテキストも書き出されます。私が実際にやりたいのは、後で使用できるように、document.writeではなくothertext+newWordを返すことです。(doc.writeを使用してコードにテキストを送信するだけです):-)
私はそれが本当に単純なことを知っていますが、どこが間違っているのかわかりません。何かアドバイス?ありがとうIssy