Re:Learning JavaScript - my experience and advice
by minikomi on Monday March 25, 2013 @01:21AM
(#5435620)
Indeed. Learning that
debugger;
will stop the interpreter at any point you like, with console scoped at that point, has sped up my JS'ing greatly
Re:Learning JavaScript - my experience and advice
by grinnick on Monday March 25, 2013 @03:48AM
(#5435899)
Wait you can what!?? Holy moly, I've been writing JS for like 3 years now and I never knew this.
Re:Learning JavaScript - my experience and advice
by minikomi on Monday March 25, 2013 @03:57AM
(#5435917)
Yep - as long as dev tools are open. Works everywhere, even in eg. underscore templates, backbone init functions..
Re:Learning JavaScript - my experience and advice
by thisone on Monday March 25, 2013 @11:54AM
(#5437670)
chrome extension content scripts...
Re:Learning JavaScript - my experience and advice
by d0gsbody on Monday March 25, 2013 @12:05PM
(#5437744)
You should watch Discover DevTools then.
Re:Learning JavaScript - my experience and advice
by chunkbot on Monday March 25, 2013 @08:18AM
(#5436582)
Holy shit! I've been programming in JavaScript for years and never heard about the debugger statement. This looks great for really understanding the details of JavaScript's object model.
Re:Learning JavaScript - my experience and advice
by jasonkostempski on Monday March 25, 2013 @08:59AM
(#5436707)
Also that little stop sign shaped pause button in Chrome will 'Pause on all exceptions' (blue) or 'Pause on all uncaught exceptions' (purple, I usually leave it on this).
Re:Learning JavaScript - my experience and advice
by afandian on Monday March 25, 2013 @08:46AM
(#5436662)
Doesn't a breakpoint do exactly the same thing?
Re:Learning JavaScript - my experience and advice
by minikomi on Monday March 25, 2013 @09:23AM
(#5436792)
Yep! I find it easier to use the debugger statement though when changing code a lot. Also, some places like compiled templates are difficult to set the breakpoint so it's useful there too.
Re:Learning JavaScript - my experience and advice
by joelhooks on Monday March 25, 2013 @09:32AM
(#5436827)
Just watch out, we get these committed semi-frequently. Whoops!
Re:Learning JavaScript - my experience and advice
by zhodge on Monday March 25, 2013 @03:24AM
(#5435856)
I've been reading up on all of the hacker schools (Dev Bootcamp, App Academy, etc.) and I was really excited to find out about Hack Reactor: I have very minimal programming experience, but have found JavaScript a pleasure to work with.
I look forward to applying to Hack Reactor when it's financially feasible! :)
Re:Learning JavaScript - my experience and advice
by aw3c2 on Monday March 25, 2013 @07:55AM
(#5436520)
What exactly do you mean with "dev tools"? Any specific browser?
Re:Learning JavaScript - my experience and advice
by shaischechter on Monday March 25, 2013 @11:29AM
(#5437497)
The Developer Tools feature built into modern browsers (Chrome/Safari/FF/IE8+/probably others). Extremely useful when debugging JS. I know the Chrome one also allows remote debugging of your web site/app on Android.
Chrome instructions - https://developers.google.com/chrome-developer-tools/docs/ov... ... others are easy enough to find
Just whatever you do, remove the debugger (and console.log) statements before committing/deploying!!! I've seen this too many times and it's not nice when you end up throwing exceptions in older browsers that have no idea what these statements mean.
Shameless plug: I teach at a school for JS devs named Hack Reactor. If rewriting Underscore as a learning tool sounds like fun, you should apply. http://hackreactor.com
[1] until now. [2] Chapters 3-4. http://discover-devtools.codeschool.com/chapters/3