When you can't find split as in the image
VM439:1 Uncaught TypeError: Cannot read property 'split' of undefined at
If split returns a null value, I want the console to respond 'error', but if it does, it should print completed.
I want it to write an 'error' response instead of a red-banded error in the console, how can I do it?
Code:
token = document.head.innerHTML.split('"encryptedTokenJarContents":"')[1].split('"')[0];
if (token === "") {
alert('error');
}else {
alert('completed');
}
Aucun commentaire:
Enregistrer un commentaire