JavaScript

debugger statement & breakpoints

Në shqip përdoret i njëjti emër.

ShpjegimiSQ

Po shkrove debugger; në kod dhe e ke hapur DevTools-in, shfletuesi e ndal programin aty. Pastaj e ekzekuton hap pas hapi dhe sheh vlerat e variablave — shumë më mirë se console.log kudo.

EnglishEN

If you write debugger; in your code and DevTools is open, the browser pauses the program there. Then you step through it and see variable values — much better than console.log everywhere.

Si ta mendosh

Si butoni i pauzës në video: e ndal në momentin e saktë dhe e shikon kuadër pas kuadri.

Lexoje në anglisht

Like the pause button on a video: stop at the exact moment and go frame by frame.

Shembull kodijavascript

function llogarit(notat) {
  debugger;   // ndalet këtu kur DevTools është hapur
  return notat.reduce((a, b) => a + b) / notat.length;
}

Terma të lidhur