Debug Javascript Code | Javascript Hindi Course For Beginners ( 2023 ) #13

 

What is Bug ?

A bug is a flaw or defect in a program's code that causes it to behave unexpectedly or produce incorrect results. Bugs can be caused by a variety of factors, such as coding mistakes, hardware failures, or external factors like changes to the system environment.
 

What is Error ?

An error, on the other hand, is a mistake made by a programmer that results in incorrect code. Errors can be caused by a variety of factors, such as incorrect assumptions, poor understanding of the programming language, or simple typing mistakes.
 
By Following ways we can debug our Javascript Code
  1. By using console.log()
  1. By using debugger keyword ( Using Chrome Devtools )
  1. By using vs code for debugging code
How to start debugger
Click on Run And Debug
notion image
Select Debugger Type
notion image
Port Should be same as your running application port → In my case 5500 for live server
notion image