Gives an error when entering an empty value into value?
-
document.getElementById('FN').value = values[1][1] || '';
if the values array is empty, then an error is generated:
Uncaught TypeError: Cannot read property '1' of undefined
what did you do wrong?JavaScript Anonymous, Aug 20, 2020 -
Well, obviously.
values = []
hence values [1] = undefined
You are trying to get the element at index values [1] [1] (undefined [1])
But undefined doesn't have that. Here comes the mistake.
Cannot read property '1' of undefinedScarlett Butler
1 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!