Skip to main content
https://meta.stackoverflow.com/q/373577/1541563
Link
Patrick Roberts
  • 52.4k
  • 10
  • 120
  • 165

There is a rule in JS: Never use arguments, opt to use rest syntax ... instead. Ok, let's try. I write:

let arr = [ 16, 'mother', 'kids'];

function concatenateAll(...arr) {
  return arr.join('');
}

let arr = [16, 'mother', 'kids'];

function concatenateAll(...arr) {
  return arr.join('');
}

But the output in the console doesn't satisfy the rule. Where is my mistake?

There is a rule in JS: Never use arguments, opt to use rest syntax ... instead. Ok, let's try. I write:

let arr = [ 16, 'mother', 'kids'];

function concatenateAll(...arr) {
  return arr.join('');
}

But the output in the console doesn't satisfy the rule. Where is my mistake?

There is a rule in JS: Never use arguments, opt to use rest syntax ... instead. Ok, let's try. I write:

let arr = [16, 'mother', 'kids'];

function concatenateAll(...arr) {
  return arr.join('');
}

But the output in the console doesn't satisfy the rule. Where is my mistake?

Source Link

Rest syntax in javascript

There is a rule in JS: Never use arguments, opt to use rest syntax ... instead. Ok, let's try. I write:

let arr = [ 16, 'mother', 'kids'];

function concatenateAll(...arr) {
  return arr.join('');
}

But the output in the console doesn't satisfy the rule. Where is my mistake?