Gives an error when entering an empty value into value?
document.getElementById('FN').value = values || '';
if the values array is empty, then an error is generated:
Uncaught TypeError: Cannot read property '1' of undefined
values = 
hence values  = undefined
You are trying to get the element at index values   (undefined )
But undefined doesn't have that. Here comes the mistake.
Cannot read property '1' of undefinedScarlett Butler
To place the code, please use CodePen or similar tool. Thanks you!