How to Debug JS Code

First open the developer tools  :

Windows: CTRL-SHIFT-J OR F12
Mac: ⌥-⌘-J

Go to the sources tab (if nothing appears, keep the developer tools open and reload the page).

By clicking on the line number, you can enable or disable breakpoints. When your code reaches that point, it will stop there so you can monitor what happens, step-by-step 🎓.

📘  NoteYou can also write code inside the console to try your code and check your variables values.