+ 2

How do you do exception (not event) handling in JavaScript

In python you van use a try and except block to except any errors and so the prglogram will do something if there is an error but can you do that in JavaScript

27th Sep 2017, 12:53 PM
Bryan
Bryan - avatar
1 Odpowiedź
+ 1
var x; try { var x = 1; // Error since x is already declared } catch(e) { console.log(e); // Logs the error }
28th Sep 2017, 12:37 PM
Edhi7
Edhi7 - avatar