So for my cit class I have to write a pig Latin converter program and I m really confused on how to use arrays and strings together. The rules for the conversion are simple, you just move the first letter of the word to the back and then add ay. ex: hell in English would be ellhay in pig Latin I have this so far:
<form name="form">
<p>English word/sentence:</p> <input type="text" id="english" required="required" size="80" /> <br />
<input type="button" value="Translate!" onClick="translation()" />
<p>Pig Latin translation:</p> <textarea name="piglat" rows="10" cols="60"></textarea>
</form>
<script type="text/javascript">
<!--
fucntion translation() {
var delimiter = " ";
input = document.form.english.value;
tokens = input.split(delimiter);
output = [];
len = tokens.length;
i;
for (i = 1; i<len; i++){
output.push(input[i]);
}
output.push(tokens[0]);
output = output.join(delimiter);
}
//-->
</script>
我真的赞赏我能得到的任何帮助!