Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

show json data in table using javascript

<table>
	<head>
    	<th>#</th>
        <th>Name</th>
    </head>
    <body>

    </body>
</table>


<script>
        let cars = ['Honda', 'Ferrari', 'Lambhorgini'];
        let data = '';
        let body = document.querySelector('body');
        
        for(var i=0; i< cars.length; i++)
        {
        	data = data + '<tr><td>' + (i+1) + '</td><td>' + cars[i] +'</td></tr>';
        }
        
        body.appendChild(data);
</script>
 
PREVIOUS NEXT
Tagged: #show #json #data #table #javascript
ADD COMMENT
Topic
Name
7+1 =