Multiple choice technology programming languages


var one = ["a", "b"];       
var two = ["c", "d"];       
var three = one.concat(two);        alert(three);       

  1. abcd

  2. a,b,c,d

  3. c,d,a,b

  4. error

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The concat() method joins arrays together. ['a','b'].concat(['c','d']) creates a new array ['a','b','c','d']. When an array is converted to string (by alert), it displays with commas: 'a,b,c,d'. Option A is wrong because arrays don't automatically join without separators.