I am trying to get it so that the result is the rest of the word + first letter + 'ay'; right now my code is giving me the total number of letters + first letter + 'ay'. I believe my third variable is what is causing this to happen but I don't know how to fix it.
function PigLatin()
// assumes: word is given by user
// results: word reshaped in piglatin
{
var word, firstletter, restofword
word = document.getElementById('wordbox').value;
firstletter = word.charAt(0);
restofword = (1, word.length);
document.getElementById('outputDiv').innerHTML = (restofword + firstletter + 'ay');
}
<h1>Pig Latin</h1>
<p>What is your word? <input type="text" id="wordbox" value="" ;></p>
<input type="button" value="Click here to convert" onclick="PigLatin();">
<hr>
<div id=outputDiv></div>