Hello I'm trying to create an app that accepts input from a user then sends it to an array to be printed to the screen. I'm having trouble getting array to loop properly, and print to the screen. Here's what I have so far:

```
var groceries = getGroceries();
printGroceries(groceries);

function getGroceries() {

    var canExit = false;
    var myGroceries = new Array();
    while (myGroceries != 'q') {

        myGroceries = prompt("Enter an item to add to the grocery list (enter \‘q\’ to quit):", null);

        if ((myGroceries !== null) && (myGroceries != "q")) {
            myGroceries.push(myGroceries);
            canExit = true;
        }
    }
    return myGroceries;

}

function printGroceries() {

    if (myGroceries.length > 0) {
        document.write("Here’s your grocery list:<br><br>" + myGroceries.join("<br><br>"));

        } else {
            document.write("Sorry, your list is empty.");

        }
}

```