Sorted Union array access

Sorted Union array access
0

#1

Tell us what’s happening:
I can not access to array element???
example: arr[0][1] does not return anything!

Your code so far

function uniteUnique(arr) {
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  return arr[0][1];
}

uniteUnique([1, 3, 2], [1, [5]], [2, [4]]);

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36.

Link to the challenge:


#2

Well, arr[0] is the number 1, so since the number one is not an array, when you try to access 1[1], you are going to get undefined.


#3

Thanks for reply, i figure out problem :smiley: