I'm attempting to verify if a received string is JSON and I experimented with the code below:
try {
JSON.parse(-10); // Also tried with "-10"
}catch(e) {
console.log('inside catch');
}
Surprisingly, the code never enters the catch block! What could be the reason behind this?