{"id":62,"date":"2006-01-06T00:59:00","date_gmt":"2006-01-06T00:59:00","guid":{"rendered":"http:\/\/blog.trungson.com\/?p=62"},"modified":"2006-01-06T00:59:00","modified_gmt":"2006-01-06T00:59:00","slug":"passing-arguments-to-a-javascript-function","status":"publish","type":"post","link":"http:\/\/blog.trungson.com\/?p=62","title":{"rendered":"Passing Arguments to a JavaScript Function"},"content":{"rendered":"<p><textarea name=\"code\" class=\"javascript\"><br \/>\nfunction foo() {<br \/>\n var argv = foo.arguments;<br \/>\n var argc = argv.length;<br \/>\n for (var i = 0; i < argc; i++) {\n   alert(\"Argument \" + i + \" = \" + argv[i]);\n }\n}\n<\/textarea><\/p>\n<p>Firefox 1.5 returns &#8220;Warning: deprecated arguments usage&#8221;<br \/>\nSolution: &#8220;var argv = arguments;&#8221;<br \/>\nReference:<br \/>\nhttp:\/\/developer.mozilla.org\/en\/docs\/Core_JavaScript_1.5_Reference:Functions:arguments<br \/>\n&#8220;The arguments object is a local variable available within all functions; arguments as a property of Function can no longer be used.&#8221;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>function foo() { var argv = foo.arguments; var argc = argv.length; for (var i = 0; i < argc; i++) { alert(\"Argument \" + i + \" = \" + argv[i]); } } Firefox 1.5 returns &#8220;Warning: deprecated arguments usage&#8221; Solution: &#8220;var argv = arguments;&#8221; Reference: http:\/\/developer.mozilla.org\/en\/docs\/Core_JavaScript_1.5_Reference:Functions:arguments &#8220;The arguments object is a local variable available [&hellip;]\n<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/posts\/62"}],"collection":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=62"}],"version-history":[{"count":0,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/posts\/62\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=62"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=62"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=62"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}