How to use the question function from readline

Find comprehensive JavaScript readline.question code examples handpicked from public code repositorys.

72
73
74
75
76
77
78
79
80
81
  },
  actions: [askForServingSize, displayCalories],
};

function askForServingSize(food) {
  readline.question(
    `How many servings did you eat? ( as a decimal: 1, 0.5, 1.25, etc.. ) `,
    servingSize => {
      if (servingSize === 'nevermind' || servingSize === 'n') {
        actionIt.return();
fork icon0
star icon0
watch icon1

+ 9 other calls in file

789
790
791
792
793
794
795
796
797
798
799
}


function game_simulation() {
    console.log("=================== CREACIÓN DE PARTIDA Y JUGADORES ===================")
    game = create_game(generate_code())
    rl.question(`<Press enter to join>`, () => {
        game.players.push(create_player(ids[0]))
        console.log(`====> Player #${game.players[0].id} has joined`) 
        rl.question(`<Press enter to join>`, () => {
            game.players.push(create_player(ids[1]))
fork icon0
star icon0
watch icon1

+ 68 other calls in file