Hosting Solutions
mobile_logo Table of Contents
seal_frontseal_back

JavaScript Arguments Object Function Tutorial

In this exercise we explore the Arguments object in JavaScript. Which enables us to create special functions that can intake an undetermined amount of arguments. All of the functions we write, have an arguments object tied to them that we can access.

Access function arguments using their index position. function doSomething() { alert( arguments[0]+" "+arguments[1] ); } doSomething("Hello", "World"); Access function arguments through iteration with a loop. function sum() { var result = 0; for( i = 0; i < arguments.length; i++ ){ result += arguments[i]; } return result; } alert( sum(10, 5, 2, 3, 10) );

Nuts and Bolts Used

function JavaScript statement Arguments JavaScript object for JavaScript statement return JavaScript statement alert JavaScript method

thumb

JavaScript Videos

General Programming

Flat Icons HTML Code Symbols Discovery JavaScriptHow to Program Code Syntax Highlighter Using JavaScriptFat Arrow Functions JavaScript Programming TutorialJavaScript Arguments Object Function TutorialJavaScript Storage Interface sessionStorage localStorage TutorialMulti Column Layout Grid Programming TutorialCustom Alert Box Programming TutorialCustom Confirm Box Programming TutorialCustom Prompt Box Programming TutorialChange CSS Class Style className Toggle TutorialPartial Print Document Tutorial HTML div ContentClick Outside Close Menu Box TutorialPercent Math Calculations Programming TutorialDual Image Reveal Control TutorialPage Loading Screen Document Preloader TutorialControl Panel Flyout Menu Windows AnimationsCustom Data Attributes HTML JavaScript CSS TutorialFullscreen API JavaScript Code Examples and SpecificationConsole Log Tutorial Chrome Firefox IE BrowsersToggle Function Click Drop Down Menus TutorialChange Tab Text and Window Title On The Fly TutorialDice Roll Programming Tutorial For Web Browser GamesDynamic Lorem Ipsum Placeholder Text TutorialBest HTML Event Handling addEventListener TutorialsetAttribute removeAttribute Methods TutorialDisabled User Handling Redirect WebsiteCapture Keyboard Input Tutorial HTML ApplicationCapture Keyboard Input Condition Logic TutorialChange Style Sheet Using Tutorial CSS Swap StylesheetWeb Page Overlay Tutorial Transparent CoverLights Out For Earth Day Tutorial Dark Page SwitchWindow Size Responsive CSS Layout Stylesheet Change TutorialRead Mouse Coordinates Pointer Position Tutorial