Can I use 'try' tag in javascript? If yes how? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Can I use 'try' tag in javascript? If yes how?

Can I use 'try' tag in javascript? If yes how?

10th Apr 2019, 6:10 PM
Ocram Co
Ocram Co - avatar
5 Answers
+ 3
try{ //some code } catch(error){ //handle error here }
10th Apr 2019, 6:45 PM
Dragonxiv
Dragonxiv - avatar
+ 5
You could handle exceptions in javascript like this: window.onload = function() {   try {     throw "An exception";   } catch(exception) {     console.log(exception);   } }
10th Apr 2019, 6:50 PM
Javier Felipe Toribio
Javier Felipe Toribio - avatar
+ 4
That piece of code is javascript. ECMAscript is the standard specification of js
10th Apr 2019, 7:17 PM
Javier Felipe Toribio
Javier Felipe Toribio - avatar
+ 3
Javier Felipe Toribio thanks but its ECMAscript6
10th Apr 2019, 6:57 PM
Ocram Co
Ocram Co - avatar
+ 2
but in sololearn the code debugger don't suported the EcMAscript6.
18th Apr 2019, 11:20 PM
Ocram Co
Ocram Co - avatar