“It is what I know” • “Internal apps work with Firefox” ¿Why should we use Chrome Devtools? • Great ability to stop where it is needed • Integrated with V8 (or with SquirrelFish) • Multiple implementations
error • It does not exist if there is not a debugger! – But only sometimes… "use strict"; function test(n) { var dbl = 2 * n; console.log('Double', dbl); }
object.__defineGetter__(property, function() { return value; }); object.__defineSetter__(property, function(newValue) { debugger; value = newValue; }); } Stop when a value is called
(i = 0; i < 10; i++) { if (i === 4) { jobId = 2; } } return jobId; } function advancedThing() { var scope = {jobId: 1}; var i; monitor(scope, 'jobId'); with (scope) { for (i = 0; i < 10; i++) { if (i === 4) { jobId = 2; } } return jobId; } }
code – “debugger;” – BP o conditional BP • Stop when a method is called – We assign a new method (with debugger inside) – MyObject.method = function() { debugger; }; • Stop when value of a property changes – We use “__defineSetter__” – If it is an array, we stop when we call “push” (see above) – list.push = function() { debugger; };