please tell me what do you mean by the flowing line"If you pass more arguments than are defined, they will be assigned to an arr | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

please tell me what do you mean by the flowing line"If you pass more arguments than are defined, they will be assigned to an arr

27th Nov 2020, 3:52 PM
Ashikur Rahman
Ashikur Rahman - avatar
1 Answer
+ 2
Please tag a relevant language name apart from 'parameters' ☝ You can write in the Description if the title section isn't enough to type in completely. As for your question, quoting from https://www.sololearn.com/learn/JavaScript/1147/ "If you pass more arguments than are defined, they will be assigned to an array called arguments. They can be used like this: arguments[0], arguments[1], etc." Let's say you define a function with only 1 parameter ... function myFunction(a) { // codes here } But you call the function passing more than 1 argument ... myFunction("Hello", 123, 45.6, true); Javascript will store arguments into an array named 'arguments'. And you can access it inside the function as follows ... function myFunction(a) { console.log(arguments[0]); // Hello console.log(arguments[1]); // 123 // and so on ... } As a future reference, please follow this guide when posting a question https://www.sololearn.com/Discuss/333866/?ref=app
27th Nov 2020, 4:11 PM
Ipang