title: JSP problem in returning value from JavaScript and access in table
body: <p>In javascript I am using the following function mdcal() and I want to use the values from the arrays mname,mresult in the table. I am unable to access the variables in table. Please help me to return the values from the function and use in table. If there is any other way please let me know. A sample of the code is shown below:</p>
  <pre><code>  function mdcal(){
       const mname = [&quot;Jan 2021&quot;, &quot;Feb 2021&quot;, &quot;Mar 2021&quot;];
       const mresult = [&quot;9.886&quot;, &quot;10.011&quot;, &quot;22.012&quot;];
        }
  </code></pre>
  <p>Table in JSP:</p>
  <pre><code> &lt;table&gt;        
    &lt;tr&gt;
              &lt;c:forEach items=&quot;${mname}&quot; var=&quot;mnm&quot;&gt;
                         &lt;th&gt;${mnm}&lt;/th&gt;          
                  &lt;/c:forEach&gt;
    &lt;/tr&gt; 
    &lt;tr&gt;
                  &lt;c:forEach items=&quot;${mresult}&quot; var=&quot;mres&quot;&gt;
                      &lt;td&gt;${mres}&lt;/td&gt;                    
                      &lt;/c:forEach&gt;
   &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>