title: How to pass a resolved promise value to another function?
body: <p>How do I pass the the returned <code>Promise</code> value to another function? I need to retrieve a parsed <code>JSON</code> data and then <strong>use that response data</strong> to send to Slack channel.</p>
  
  <p>My index.js</p>
  
  <pre><code>// Get the data
  let getData = () =&gt; {
      axios.get('https://jsonplaceholder.typicode.com/posts/1').then(res =&gt; {
          const responseJSON = res.data
          return responseJSON
      })
      .catch(err =&gt; {
          console.log(`Error in getData(): ${err}`)
      })
  }
  
  // Post to Slack (real-time)
  let slack = () =&gt; {
      axios.post('url-to-post-to', {
              'text':  getData().toString() // This has to be a string, but right now it's returning [object Promise]
          })
          .catch(err =&gt; {
              console.error(`Error in SLACK: ${err.response.data}`)
          })
  }
  </code></pre>
  
  <p>Right now I'm getting <code>[object Promise]</code> in Slack channel, but I need the <code>JSON</code> that is returning in a form of <strong>string</strong>.</p>
  
  <p>I think that I'm trying to pass a value that has not yet been resolved, but the problem is, I don't know how to pass the value after it has been resolved.</p>
  
  <p>Any help is appreciated.</p>