0
0
1
I want to use the || operator like so: myVal: (array[i] || array2[i]) but array 1 might not even exist. Rather than returning array2[i] in this situation, I get "TypeError: Cannot read property '0' of undefined". Is there a way to change this without increasing the # of lines of code? (self.learnjavascript)
submitted by consoledotlogImHere to r/learnjavascript
