I am a novice in the field of coding. Every time I try to put something in the prompt box, it only saves the last string entered. In this case, my command to end "done".
I have already resolved using a for loop and a function to save the data. However, I am confused as to why it is not working with the while loop. Cause as far as I see, for and while are similar to each other, with the difference that a while loop doesn't need a start-value and that you put the incrementation in the curly-brackets.
Ultimately I want to type in 'Max' and it should show on the next html-file, 'Max' and not 'done'.
<!DOCTYPE html>
<html>
    <head>
        <title>dude</title>
        <script type="text/javascript">
            'use strict'
            var i, Enter; 
            var dude=[];
        </script>
        <meta charset="utf-8" />
    </head>
    <body>
    <script type="text/javascript">
        while (Enter!='done')
        {
            i++
            if (dude[i]='done')
            {
                Enter=prompt("some text");
                dude[i]=Enter
                SaveData(dude[i]);
            }
        }
        function SaveData()
        {
            localStorage.setItem("DATA", dude[i]);
        }
        
    </script>
    </body>
</html>
 
     
     
    