0

How can one debug in JavaScript

Debug in Javascript

17th Jan 2020, 1:08 AM
Sash The Smartest Alien
Sash The Smartest Alien - avatar
3 odpowiedzi
+ 1
Any example please. Thanks
17th Jan 2020, 8:28 AM
Sash The Smartest Alien
Sash The Smartest Alien - avatar
+ 1
Example please. Thanks
17th Jan 2020, 8:30 AM
Sash The Smartest Alien
Sash The Smartest Alien - avatar
0
Console.log is your greatest friend I think. Chrome tools console used with it would be very helpful. you can define the function below in a js script. const add=(x,y)=>x+y; run the script directly from the linked html file or through live server. on chrome you can press f12 and access console. then run console.log(add(2,3)) which should run without errors. you can then try console.log(add(3,6,3)) that should give an error because the function gets more arguments than it expects. the error message is actually helpful in debugging.
17th Jan 2020, 7:59 AM
LEO OJIGBO
LEO OJIGBO - avatar