**Tell us what’s happening:**

Describe your issue in detail here.

Can someone help me in changing this function to an arrow function

```
**Your code so far**
```

```
let total = 0;
function sum(...inputs) {
for (let i of inputs) {
total+=i;
}
return total;
}
```

```
**Your browser information:**
```

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36 Edg/103.0.1264.62`

**Challenge:** ES6 - Use the Rest Parameter with Function Parameters

**Link to the challenge:**

I just wanna know how to get loops inside arrow function

The exact same way as any other function syntax? Can you show what you tried?

ilenia
6
in the same way as usual

```
() => {
for (...) {}
while () {}
do {} while ()
}
```

it’s there at the beginning

ilenia
8
and that’s a loop inside a function, if it doesn’t do what you expect it’s not because it’s a loop

what issues are you having with it?

let total = 0;

function sum(…inputs) {

for (let i of inputs) {

total+=i;

}

return total;

}

Can you make this whole code into an arrow function??

ilenia
10
yes, you just need to change the definition to be an arrow function

ilenia
11
note that that will not be enough to solve the challenge, for that you will need to follow Randy’s post above

It didn’t look like any sort of arrow function, which is why I asked for your attempts to convert it to an arrow function.

system
Closed
13
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.