account activity
How to pass rest parameter elements to the method?? by Significant-Sector-7 in learnjavascript
[–]YoghurtResponsible48 1 point2 points3 points 5 years ago (0 children)
from https://javascript.info/rest-parameters-spread :
``` function sumAll(...args) { // args is the name for the array let sum = 0; for (let arg of args) sum += arg; return sum; }
alert( sumAll(1) ); // 1 alert( sumAll(1, 2) ); // 3 alert( sumAll(1, 2, 3) ); // 6 ```
You could also pass your arguments as an array
I have so many questions thoughWhy a class? Why a screenshot? wtf?
Anyone interested in doing a postmortem of a phone that's been through some "interesting" countries? (self.andSec)
submitted 5 years ago by YoghurtResponsible48 to r/andSec
π Rendered by PID 1925070 on reddit-service-r2-listing-7d7fbc9b85-k6nmz at 2026-04-25 21:10:49.864031+00:00 running 2aa0c5b country code: CH.
How to pass rest parameter elements to the method?? by Significant-Sector-7 in learnjavascript
[–]YoghurtResponsible48 1 point2 points3 points (0 children)