JavaScript
객체_html에 출력
듀듀닷
2022. 1. 17. 03:05
<section>
<table>
<tr>
<td id="title"></td>
<td id="price"></td>
<td id="stock"></td>
</tr>
</table>
</section>
<script>
var jsbook = {
title:'자스입문',
price:2500,
stock:3
};
document.getElementById('title').textContent = jsbook.title;
document.getElementById('price').textContent = jsbook.price + '원';
document.getElementById('stock').textContent = jsbook.stock;
</script>