recursive inquirerjs prompts
const inquirer = require("inquirer");
let strategies = [];
let repeat = true;
do {
strategies.push(
await inquirer.prompt([
{
type: "input",
name: "firstname",
message: "Enter firstname",
},
{
type: "input",
name: "lastname",
message: "Enter lastname",
},
])
);
repeat = (
await inquirer.prompt([
{
type: "confirm",
name: "repeat",
message: "Do you want to add another person ?",
},
])
).repeat;
} while (repeat);
console.log(strategies);
/* Output :
[
{firstname: "first", lastname: "lastname"},
...
{firstname: "last", lastname: "lastname"}
]
*/
Also in JavaScript:
- create label dynamically in javascript
- discord.js created by command
- remove whitespace with regex javascript
- javascript format price
- dom create element
- jquery set hidden field value
- javascript array.find
- missing json after pyinstaller
- dynamically add id ro div in angular using forloop ngfor
- find max value in javascript
- loop through an array javascript
- javascript press tab key
- call apply bind
- mysql remove quote on json extract
- regular expression javascript
- js paste event
- orderbychild firebase react
- useBootstrapPrefixhttp://localhost:8000/static/js/bundle.js:15261:75
- reverse a string program in javascript
- comment out in javascript
- console.log
- how to remove property of object in javascript without delete
- reusable table in react js
- how to code a minecraft json file mod