Create a program that asks a user for a word. Then randomly generate a new word of the same length using only those letters only once
<p>This is all I got till now.. I know it is wrong. What can I do to correct this? I'm trying to create a jumbled word. Suppose "apple" to "alppe". But the letters keep repeating, so how do i fix this? Thank you!</p>

<pre><code>    var ans = ""
    var x =0
    x = parseInt(x)

    var y = 0
    y = parseInt(y)

    var z = 0
    z = parseInt(z)

    var l = 0
    l = parseInt(l)

    char = new Array()

    function letter()
    {

        word = prompt("Enter word")

        l = word.length

        for (count = 1; count &lt;= l; count++)
        {

            x = count
            char[x] = word.slice(x-1,x)
            do
            {
                y = Math.round(Math.random() * (l-1)) + 1

            }
            while(y == x)

            char[y] = word.slice(y-1,y)

            z = char[x]
            char[x] = char[y]
            char[y] = z

            ans = ans + char[x]
        }

    alert(ans)
    }
</code></pre>
