What steps will reproduce the bug?
in learyounode, excersise 2, working with rest operator:
let begin = 0;
let {,,...numbersl} = process.argv;
for(let i in numbersl) {
begin += Number(i);
};
console.log(begin);
gives an error "numbersl is not iterable".
when digging into the code:
let begin = 0;
let {ax,bx,...numbersl} = process.argv;
/*for(let i of numbersl) {
begin = (begin + Number(i));
}*/
console.log(numbersl);
the answer is:
node baby-steps.js 1 2 3
{
'0': '/usr/bin/node',
'1': '/tmp/baby-steps.js',
'2': '1',
'3': '2',
'4': '3'
}
...whereas you would expect the 0 and 1 to be removed from numbersl
How often does it reproduce? Is there a required condition?
tried several times, occurs every time
What is the expected behavior?
argument 0 and 1 are removed from numbersl
What do you see instead?
arguments are still included
Additional information