반응형
<script type="text/javascript">
function array_max( )
{
var i, max = this[0];
for (i = 1; i < this.length; i++)
{
if (max < this[i])
max = this[i];
}
return max;
}
Array.prototype.max = array_max;
var x = new Array(1, 2, 3, 4, 5, 6);
var y = x.max( );
function tt(){
alert("y : "+y);
}
</script>
<input type="button" onclick="tt();">
function array_max( )
{
var i, max = this[0];
for (i = 1; i < this.length; i++)
{
if (max < this[i])
max = this[i];
}
return max;
}
Array.prototype.max = array_max;
var x = new Array(1, 2, 3, 4, 5, 6);
var y = x.max( );
function tt(){
alert("y : "+y);
}
</script>
<input type="button" onclick="tt();">