Why does the do while loop of javascript only loop once?

The

code is as follows, but not all of it is posted, because it is too long and miscellaneous:

//123
    let answer = 0;
    do{
        defaultPage();
        answer = require("readline-sync").question();
        if(answer == 1){
            return action1(input);
        }else if(answer == 2){
            return action2(input);
        }else if(answer == 3){
            return "";
        }else{
            return "Bad choice, please choose again!"
        }
    }while(answer == 1)   
}

the running result is as follows:

clipboard.png

Mar.22,2021

suggest that return


return will end the execution of the current function, so the loop also exits

.
Menu