Javascript Data Type How to - Round some values in an object array


We would like to know how to round some values in an object array.


<!DOCTYPE html>
</head><!--   w ww  .j  av  a2 s  . c om-->
  <script type='text/javascript'>
var array = [ 
    {name:1, price:3.99, tax:0.20}, 
    {name:2, price:1.40, tax:0.15},
    {name:3, price:0.99, tax:0.10}, 
array.forEach(function ( elem ) {
    elem.price = Math.round( elem.price );
document.write( array[0].price );


The code above is rendered as follows: