<script type="text/javascript"> function sample( $arr ) { document.write( $arr[0] + " + " + $arr[1] + " = " + ( $arr[0] + $arr[1] ) ); } sample( Array( 2, 3 ) ); </script> <script type="text/javascript"> function sample( $arr ) { var $sum = 0; for ( var $key in $arr ) { $sum += $arr[$key]; } document.write( "合計: " + $sum ); } sample( Array( 1, 2, 3, 4, 5 ) ); </script>