title: How can I get a value out of inquirer.js?
body: <p>I am building a small CLI app using javascript, yargs, inquirer, and superagent. In inquirer I am asking the user to enter a choice of miles to be used in my app. I want to use that value somewhere else in my app but I can't seem to able to get the value returned. Below is my latest attempt. Any help into getting this value returned from <code>selectRange</code> would be highly appreciated.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const selectRange = (result) =&gt; {
      return inquirer.prompt([{
          type: 'checkbox',
          message: 'Select the range in miles to search',
          name: 'miles',
          choices: ['50', '100','150', '200', '250'] ,
          validate: (result) =&gt; {
              if (result.length &gt; 1) {
  
                  return 'Error: You must select 1 choice     only'
  
              } else {
                  return true
              }
          },
          filter: input =&gt; {
              return input
  
          }
  
      }]).then(input =&gt; {
          return input
      })
  }
  
  
  
  const surroundingCitiesWeather = (location) =&gt; {
  
      const range = selectRange()
  
      console.log(`Range selected is ${range}`)
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p><a href="https://i.stack.imgur.com/yW9lV.png" rel="nofollow noreferrer">Here is a pic of my output, mind the last line</a></p>