Skip to content

Instantly share code, notes, and snippets.

@Jagathishrex
Created January 5, 2021 16:22
Show Gist options
  • Save Jagathishrex/dd19f261d763365732baf12b12e5e457 to your computer and use it in GitHub Desktop.
Save Jagathishrex/dd19f261d763365732baf12b12e5e457 to your computer and use it in GitHub Desktop.
var a = [1,2,3];
var b = true;
var c = [4,5,6];
const concatAb = [].concat(a, b); // [1, 2, 3, true]
const concatAb = [].concat(a, b); // [1, 2, 3, 4, 5, 6]
@octoxalis
Copy link

Line 6 duplicates line 5, therefore error: const redeclaration!

Should be:

const concatAc = [].concat(a, c); // [1, 2, 3, 4, 5, 6]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment