I'm currently exploring open-source development, creating multiple projects which I hope one day will change the world. Join me in making our planet a better place through technology!
Not to mention that arguments is a reserved word to get all the arguments passed to a function as an iterable object (including arguments already named) without having to use the spread operator in the function's parameters list:
functiontest(a,b,c){console.log("All arguments:",arguments);// We must use the spread operator to use `forEach` as `arguments` is an object with other properties in it[...arguments].forEach(function(arg){console.log(arg);});}test("hello",123,"world",456,null);
Result:
All arguments: ["hello", 123, "world", 456, null]
hello
123
world
456
null
(Notice how arguments contains extra arguments than explicitly specified with the named a, b and c parameters.)
Great article! Browsers and even the simplest things in JS really are amazing. (For that matter, that we can turn sand into silicon and silicon into computers).
Keep up the good writing!
π Web3 & AI Developer
20K+ followers on Dev.to
Building at the intersection of AI & blockchain
Passionate about smart contracts & decentralized tech
Not to mention that
argumentsis a reserved word to get all the arguments passed to a function as an iterable object (including arguments already named) without having to use the spread operator in the function's parameters list:Result:
(Notice how
argumentscontains extra arguments than explicitly specified with the nameda,bandcparameters.)This is amazing! Thanks for the info, James. π
Great article! Browsers and even the simplest things in JS really are amazing. (For that matter, that we can turn sand into silicon and silicon into computers).
Keep up the good writing!
Thank you so much for your kind words!
I liked that reference to sand, silicon and computers, it greatly covers the fascinating hardware part.
No problem! You deserved some kindness for such awesome content!
Keep up the good work, and happy coding!
Arrays in JS have a maximum number of 2Β³Β²-2 elements regardless if they are constructed via rest operator or otherwise.
Thanks for sharing knowledge, buddy!
Didn't knew that :D
Thanks for the quick explanation.
It's my pleasure!
Thanks for reading the article.
(i'd be grateful if you shared this with your friends)
Thanks for sharing your expertise on this matter. Your depth of knowledge shines through in every paragraph.
Thanks, Alex!
Well, every master was once a beginner!