title: Unable to iterate over every item in the array of questions using promises in javascript
body: <p>I need to store the questions in an array and use the spread operator to create an array of promises and use Promise.all to wait on them and collect the answers in a different array. But my code is taking only first value and not going to the next question.</p>
  <pre><code>const rl = readline.createInterface(process.stdin, process.stdout);
  
  function PromiseAllReadline(){
     const questions=['What is you NAme?','What is your Age?','What is your Occupation?'];
     const answers=[];
     const promiseQuestions=questions.map((question)=&gt;{
         return new Promise((resolve,reject)=&gt;{
             rl.question(question,(input)=&gt;resolve(input));
         });
     });
  
     Promise.all(promiseQuestions)
       .then((values)=&gt;{
           console.log('values',values);
       })
       .catch((error)=&gt;{
           console.log('error is',error);
       });
  }
  
  PromiseAllReadline();
  </code></pre>