求任意个数数字最大值

最大值

    <script>
        function getMax(){
            var max = arguments[0];
            for(var i = 0; i < arguments.length - 1; i++){
                if(arguments[i] > max){
                    max = arguments[i];
                }
            }
            return max;
        }
        console.log(getMax(1,2,3,4,5,6,7,8));
        console.log(getMax(1,5,3));
    </script>

你可能感兴趣的:(求任意个数数字最大值)