Javascript examples for Function:Function Argument
Javascript check arguments for zero value
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=( function() {//w ww . j a va 2s.co m "use strict"; function zeroCheck(arg1,arg2) { var i, argsLen = arguments.length; for (i = 0; i <= argsLen; i += 1) { if (arguments[i] === 0) { arguments[i] = 1; } } console.log(arg1); // arg1 = 0 } zeroCheck(0,2); }); </script> </head> <body> </body> </html>