title: How do I pass id from another const to another const in JavaScript?
body: <p>I have 2 Get API I that I used to read the data. First API I used is to read the student details. In this student details there is ID that I need to read from second API and display the data in the first API</p>
  <p>First API is getDetails
  Second API is getClass</p>
  <p>I want to pass the <code>e.student_class_id</code> into the <code>getClass</code> after I have got the class name I will pass back the class name at the <code>getDetails</code></p>
  <pre><code>const getDetails= (infoID) =&gt;
      {
          axios.get(`${apiInfo}student/getDetails?student_id=${infoID}`)
          .then(function (response) { 
              if(response.data.status == 'success')
              {
                  
                  e = response.data.result;
  
                  //passing this e.student_class_id;
                  $('#tabClassName').html(`&lt;div class=&quot;col-xl-12 row&quot;&gt;
                                              &lt;div class=&quot;col-xl-6&quot;&gt;
                                                  &lt;h6&gt;Class details&lt;/h6&gt;
                                                  &lt;p&gt;Class :&lt;span class=&quot;item&quot;&gt; //and pass the class name here ? &lt;/span&gt;&lt;/p&gt;
                                              &lt;/div&gt;
                                          &lt;/div&gt;
                                          `);
              }
          });
      }
  
      const getClass= () =&gt;
      {
          axios.get(`${apiInfo}getClass`)
          .then(function (res) { 
              if(res.data.status == 'success')
                   {
                      res.data.result.map((e) =&gt;{
                           if(e.id == 'how do I pass it the e.student_class_id here ?'){
                               // return``;
                              console.log(e.class_name);
                           }
                      });
              }
          });
      }
  </code></pre>