.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal

Home >> Articles >> .Net Framework >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Multiple argument passed to a JavaScript Function at runtime

Posted By:shahin       Posted Date: February 26, 2009    Points: 25    Category: .Net Framework    URL: http://www.dotnetspark.com  

Multiple argument passed to a JavaScript Function at runtime


Today I as working with some JavaScript code and had a function where the number of parameters would change in the runtime. Actually I had to do a validation where the number of textbox to equate the value for. I wanted to pass the array of textbox to the function. 

But then I googled a bit and found a very nice feature of JavaScript which I had heard before. In JavaScript we can pass any number of parameter and get these parameter at run time.

JavaScript functions have a special property called arguments. these contain and array of the input parameters. we can use the length property of the array and loop through the parameters passed to the function. This enables the development of function where the number of parameters can change at runtime.


This function can be called with any number of arguments at the runtime like

shahinFunc('shahinam', 'Lakhotia');

Ref Passing multiple Arguments to a JavaScript Function

 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend