Does concat method join or extracts values in arrays?... The code provided outputs JS only... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Does concat method join or extracts values in arrays?... The code provided outputs JS only...

ar c1 = ["HTML", "CSS"]; var c2 = ["JS", "C++"]; var courses = c1.concat(c2); document.write(courses[2]);

1st Jan 2018, 9:03 PM
Too Vincent
Too Vincent - avatar
2 Answers
+ 12
concat returns a new concatenated array, that's why it was assigned to "var courses" in the example you provided
1st Jan 2018, 9:12 PM
Burey
Burey - avatar
+ 6
[Aside] You may have pasted this into a webcode's HTML tab (use [JS] and fix 'ar' to be 'var').
1st Jan 2018, 10:05 PM
Kirk Schafer
Kirk Schafer - avatar