SlideShare a Scribd company logo
1 of 33
Download to read offline
DEBUGGING JAVASCRIPT 
0 TO HEISENBERG 
Chris Morrow 
Senior UI Developer 
Video screencast: http://youtu.be/-q1z8BPFItw
WALTER WHITE
HEISENBERG
THE PLAN 
JAVASCRIPT BEST PRACTICES (throughout) 
BREAKPOINTS 
WATCHES 
USING THE CONSOLE 
CALL STACK 
CUSTOM TOOLS / UNIT TESTING
TOO MANY COOKS IN 
THE KITCHEN?
BEST PRACTICES 
AVOID GLOBAL VARIABLES 
<script> 
var now = new Date(); 
/* more code goes here */ 
function doSomething(){ 
alert('the time is ' + now); 
} 
</script> 
/* code below can overwrite "now" var */ 
<script src="js/dateLibrary.js"></script>
PROTECT YOUR VARIABLES WITH SCOPE 
<script> 
(function(){ // closure function 
var now = new Date(); 
/* more code goes here */ 
function doSomething(){ 
alert('the time is ' + now); 
} 
})(); 
</script> 
/* code below CAN'T change "now" var */
WHY DO PEOPLE HATE 
DEBUGGING JS? 
VARIABLES ARE GLOBAL IN SCOPE 
NO REQUIRED STRONG TYPING 
CROSS BROWSER COMPATIBILITY (IE!!!) 
NO CLASSES
DEBUGGING GOT YOU 
STRESSED?
BREAKPOINTS 
NAVIGATING CODE 
STANDARD 
CONDITIONAL
BREAKPOINTS 
Continue: continues code execution until we encounter 
another breakpoint 
Step Over: step through code line-by-line to get insights into 
how each line affects the variables being updated. Should 
your code call another function, the debugger won't jump into its 
code, instead stepping over so that the focus remains on the 
current function (scope). 
Step Into: like Step over, however clicking Step into at the 
function call will cause the debugger to move its execution 
to the first line in the functions definition. 
Step Out: having stepped into a function, clicking this will 
cause the remainder of the function definition to be run and 
the debugger will move its execution to the parent function
BEST PRACTICES
WATCHES
ADDING A WATCH: MULTIPLE WAYS 
k Sources: select then right-click 
k Click "+" on Watch Expressions panel 
k Right-click inside Watch Expressions panel
SCOPE VARIABLES 
k Like watches, but are only shown in scope
AND NOW A QUICK MESSAGE FROM OUR 
SPONSOR...
USING THE CONSOLE 
console.log() 
console.assert( expression, object ) 
console.table() 
Multiline Commands 
Snippets 
Live Editing
BEST PRACTICES 
DO NOT MINIFY CODE IN DEVELOPMENT
CALL STACK 
BOTTOMS UP
CRAPPY CODE
CLEAN UP YOUR CODE
DEBUGGING TOOLS 
ROLL YOUR OWN
PRE-DEBUGGING TOOLS 
JSHint / JSLint 
JsHint is more lenient than JSLint.
NOT HAPPY WITH 
JSHINT?
CUSTO MIZE I T WITH 
.jshintrc
UNIT TESTING 
QUnit: http://qunitjs.com/ 
Mocha: http://visionmedia.github.io/mocha/ 
Jasmine: http://jasmine.github.io/
REMOTE TESTING 
ADOBE EDGE INSPECT
RESOURCES / QUESTIONS? 
Chrome Dev Tools: 
https://developer.chrome.com/devtools 
Chrome Dev Tools: Tips & Tricks 
https://developer.chrome.com/devtools/docs/tips-and-tricks 
jQuery Learning Center: 
http://learn.jquery.com/javascript-101/ 
Design Patterns: 
http://addyosmani.com/resources/essentialjsdesignpatterns/book/ 
Douglas Crockford: Javascript the Good Parts 
http://javascript.crockford.com/
Debugging Javascript - 0 to Heisenberg

More Related Content

What's hot

Getting Started with Tizen TV Web Apps
Getting Started with Tizen TV Web AppsGetting Started with Tizen TV Web Apps
Getting Started with Tizen TV Web AppsRyo Jin
 
Using Prometheus to monitor your build pipelines
Using Prometheus to monitor your build pipelinesUsing Prometheus to monitor your build pipelines
Using Prometheus to monitor your build pipelinesLander Van den Bulcke
 
Openstack Vagrant plugin overview
Openstack Vagrant plugin overviewOpenstack Vagrant plugin overview
Openstack Vagrant plugin overviewMarton Kiss
 
Enterprising JavaFX
Enterprising JavaFXEnterprising JavaFX
Enterprising JavaFXRichard Bair
 
Droidcon ES '16 - How to fail going offline
Droidcon ES '16 - How to fail going offlineDroidcon ES '16 - How to fail going offline
Droidcon ES '16 - How to fail going offlineJavier de Pedro López
 
Site Testing with CasperJS
Site Testing with CasperJSSite Testing with CasperJS
Site Testing with CasperJSJoseph Scott
 
Phone gap android plugins
Phone gap android pluginsPhone gap android plugins
Phone gap android pluginsSimon MacDonald
 
Level up your front-end skills- going beyond cold fusion’s ui tags
Level up your front-end skills- going beyond cold fusion’s ui tagsLevel up your front-end skills- going beyond cold fusion’s ui tags
Level up your front-end skills- going beyond cold fusion’s ui tagsColdFusionConference
 
Using Composer with WordPress
Using Composer with WordPressUsing Composer with WordPress
Using Composer with WordPressMicah Wood
 
IS YOUR WIDGET FAST? FIVE BEST PRACTICES TO FASTER EMBEDDABLE CONTENT
IS YOUR WIDGET FAST? FIVE BEST PRACTICES TO FASTER EMBEDDABLE CONTENTIS YOUR WIDGET FAST? FIVE BEST PRACTICES TO FASTER EMBEDDABLE CONTENT
IS YOUR WIDGET FAST? FIVE BEST PRACTICES TO FASTER EMBEDDABLE CONTENTIsmail Elshareef
 
Superfast Automated Web Testing with CasperJS & PhantomJS
Superfast Automated Web Testing with CasperJS & PhantomJS Superfast Automated Web Testing with CasperJS & PhantomJS
Superfast Automated Web Testing with CasperJS & PhantomJS Hervé Vũ Roussel
 
End to-end testing from rookie to pro
End to-end testing  from rookie to proEnd to-end testing  from rookie to pro
End to-end testing from rookie to proDomenico Gemoli
 
CasperJS and PhantomJS for Automated Testing
CasperJS and PhantomJS for Automated TestingCasperJS and PhantomJS for Automated Testing
CasperJS and PhantomJS for Automated TestingX-Team
 
Introduction to phone gap
Introduction to phone gapIntroduction to phone gap
Introduction to phone gapDanet Krueng
 
RxSwift for Beginners - how to avoid a headache of reactive programming
RxSwift for Beginners - how to avoid a headache of reactive programmingRxSwift for Beginners - how to avoid a headache of reactive programming
RxSwift for Beginners - how to avoid a headache of reactive programmingMaciej Kołek
 

What's hot (18)

Getting Started with Tizen TV Web Apps
Getting Started with Tizen TV Web AppsGetting Started with Tizen TV Web Apps
Getting Started with Tizen TV Web Apps
 
Auto Build
Auto BuildAuto Build
Auto Build
 
Using Prometheus to monitor your build pipelines
Using Prometheus to monitor your build pipelinesUsing Prometheus to monitor your build pipelines
Using Prometheus to monitor your build pipelines
 
Openstack Vagrant plugin overview
Openstack Vagrant plugin overviewOpenstack Vagrant plugin overview
Openstack Vagrant plugin overview
 
Enterprising JavaFX
Enterprising JavaFXEnterprising JavaFX
Enterprising JavaFX
 
Droidcon ES '16 - How to fail going offline
Droidcon ES '16 - How to fail going offlineDroidcon ES '16 - How to fail going offline
Droidcon ES '16 - How to fail going offline
 
Site Testing with CasperJS
Site Testing with CasperJSSite Testing with CasperJS
Site Testing with CasperJS
 
Phone gap android plugins
Phone gap android pluginsPhone gap android plugins
Phone gap android plugins
 
Level up your front-end skills- going beyond cold fusion’s ui tags
Level up your front-end skills- going beyond cold fusion’s ui tagsLevel up your front-end skills- going beyond cold fusion’s ui tags
Level up your front-end skills- going beyond cold fusion’s ui tags
 
Using Composer with WordPress
Using Composer with WordPressUsing Composer with WordPress
Using Composer with WordPress
 
IS YOUR WIDGET FAST? FIVE BEST PRACTICES TO FASTER EMBEDDABLE CONTENT
IS YOUR WIDGET FAST? FIVE BEST PRACTICES TO FASTER EMBEDDABLE CONTENTIS YOUR WIDGET FAST? FIVE BEST PRACTICES TO FASTER EMBEDDABLE CONTENT
IS YOUR WIDGET FAST? FIVE BEST PRACTICES TO FASTER EMBEDDABLE CONTENT
 
Superfast Automated Web Testing with CasperJS & PhantomJS
Superfast Automated Web Testing with CasperJS & PhantomJS Superfast Automated Web Testing with CasperJS & PhantomJS
Superfast Automated Web Testing with CasperJS & PhantomJS
 
End to-end testing from rookie to pro
End to-end testing  from rookie to proEnd to-end testing  from rookie to pro
End to-end testing from rookie to pro
 
Flask
FlaskFlask
Flask
 
CasperJS and PhantomJS for Automated Testing
CasperJS and PhantomJS for Automated TestingCasperJS and PhantomJS for Automated Testing
CasperJS and PhantomJS for Automated Testing
 
Vagrant and chef
Vagrant and chefVagrant and chef
Vagrant and chef
 
Introduction to phone gap
Introduction to phone gapIntroduction to phone gap
Introduction to phone gap
 
RxSwift for Beginners - how to avoid a headache of reactive programming
RxSwift for Beginners - how to avoid a headache of reactive programmingRxSwift for Beginners - how to avoid a headache of reactive programming
RxSwift for Beginners - how to avoid a headache of reactive programming
 

Viewers also liked

Missing vin (1)
Missing vin (1)Missing vin (1)
Missing vin (1)Osopher
 
GeoMapFish, the Open Source WebGIS
GeoMapFish, the Open Source WebGISGeoMapFish, the Open Source WebGIS
GeoMapFish, the Open Source WebGISCamptocamp
 
A Measurement Study of 4chan’s Politically Incorrect Forum and Its Effects on...
A Measurement Study of 4chan’s Politically Incorrect Forum and Its Effects on...A Measurement Study of 4chan’s Politically Incorrect Forum and Its Effects on...
A Measurement Study of 4chan’s Politically Incorrect Forum and Its Effects on...Emiliano De Cristofaro
 
Moving beyond Blackboard: The VLE journey at Dundee
Moving beyond Blackboard: The VLE journey at DundeeMoving beyond Blackboard: The VLE journey at Dundee
Moving beyond Blackboard: The VLE journey at DundeeNatalie Lafferty
 
announcements- Friday March 31, 2017
announcements- Friday March 31, 2017announcements- Friday March 31, 2017
announcements- Friday March 31, 2017Ken Stayner
 
All the basics that interior designers work on
All the basics that interior designers work onAll the basics that interior designers work on
All the basics that interior designers work onNitidodesign
 
LCMS-MS Method for Evaluation of PPCPs in Environmental Water
LCMS-MS Method for Evaluation of PPCPs in Environmental WaterLCMS-MS Method for Evaluation of PPCPs in Environmental Water
LCMS-MS Method for Evaluation of PPCPs in Environmental WaterShimadzu Scientific Instruments
 

Viewers also liked (14)

MVS: An angular MVC
MVS: An angular MVCMVS: An angular MVC
MVS: An angular MVC
 
C All 2008 7 22
C All 2008 7 22C All 2008 7 22
C All 2008 7 22
 
Csfpt ppcr mars 2017
Csfpt ppcr mars 2017Csfpt ppcr mars 2017
Csfpt ppcr mars 2017
 
You are valuable
You are valuableYou are valuable
You are valuable
 
Missing vin (1)
Missing vin (1)Missing vin (1)
Missing vin (1)
 
GeoMapFish, the Open Source WebGIS
GeoMapFish, the Open Source WebGISGeoMapFish, the Open Source WebGIS
GeoMapFish, the Open Source WebGIS
 
A Measurement Study of 4chan’s Politically Incorrect Forum and Its Effects on...
A Measurement Study of 4chan’s Politically Incorrect Forum and Its Effects on...A Measurement Study of 4chan’s Politically Incorrect Forum and Its Effects on...
A Measurement Study of 4chan’s Politically Incorrect Forum and Its Effects on...
 
Dossier Pedagogique Festival Electrochoc 12
Dossier Pedagogique Festival Electrochoc 12 Dossier Pedagogique Festival Electrochoc 12
Dossier Pedagogique Festival Electrochoc 12
 
Moving beyond Blackboard: The VLE journey at Dundee
Moving beyond Blackboard: The VLE journey at DundeeMoving beyond Blackboard: The VLE journey at Dundee
Moving beyond Blackboard: The VLE journey at Dundee
 
Maar wat is Sosiale Media?
Maar wat is Sosiale Media?Maar wat is Sosiale Media?
Maar wat is Sosiale Media?
 
announcements- Friday March 31, 2017
announcements- Friday March 31, 2017announcements- Friday March 31, 2017
announcements- Friday March 31, 2017
 
S3 a1 liberatom_leslieg
S3 a1 liberatom_lesliegS3 a1 liberatom_leslieg
S3 a1 liberatom_leslieg
 
All the basics that interior designers work on
All the basics that interior designers work onAll the basics that interior designers work on
All the basics that interior designers work on
 
LCMS-MS Method for Evaluation of PPCPs in Environmental Water
LCMS-MS Method for Evaluation of PPCPs in Environmental WaterLCMS-MS Method for Evaluation of PPCPs in Environmental Water
LCMS-MS Method for Evaluation of PPCPs in Environmental Water
 

Similar to Debugging Javascript - 0 to Heisenberg

Debugging Javascript
Debugging JavascriptDebugging Javascript
Debugging JavascriptSolTech, Inc.
 
Debugger & Profiler in NetBeans
Debugger & Profiler in NetBeansDebugger & Profiler in NetBeans
Debugger & Profiler in NetBeansHuu Bang Le Phan
 
Cucumber meets iPhone
Cucumber meets iPhoneCucumber meets iPhone
Cucumber meets iPhoneErin Dees
 
Release with confidence
Release with confidenceRelease with confidence
Release with confidenceJohn Congdon
 
Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)Mikkel Flindt Heisterberg
 
Tom Germeau: Mobile Apps: Finding the balance between performance and flexibi...
Tom Germeau: Mobile Apps: Finding the balance between performance and flexibi...Tom Germeau: Mobile Apps: Finding the balance between performance and flexibi...
Tom Germeau: Mobile Apps: Finding the balance between performance and flexibi...Chartbeat
 
413450-rc218-cdw-jenkins-workflow
413450-rc218-cdw-jenkins-workflow413450-rc218-cdw-jenkins-workflow
413450-rc218-cdw-jenkins-workflowAndy Pemberton
 
CoffeeScript, An Introduction for Nodejs developers
CoffeeScript, An Introduction for Nodejs developersCoffeeScript, An Introduction for Nodejs developers
CoffeeScript, An Introduction for Nodejs developersMehdi Valikhani
 
Continous Delivering a PHP application
Continous Delivering a PHP applicationContinous Delivering a PHP application
Continous Delivering a PHP applicationJavier López
 
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven PignataroJoomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven PignataroSteven Pignataro
 
React Native in Production
React Native in ProductionReact Native in Production
React Native in ProductionSeokjun Kim
 
Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...
Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...
Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...Cloud Native Day Tel Aviv
 
Real world Webapp
Real world WebappReal world Webapp
Real world WebappThings Lab
 
2011 py con
2011 py con2011 py con
2011 py conEing Ong
 
Debugging with VS2019
Debugging with VS2019Debugging with VS2019
Debugging with VS2019Mirco Vanini
 
20150812 4시간만에 따라해보는 windows 10 앱 개발
20150812  4시간만에 따라해보는 windows 10 앱 개발20150812  4시간만에 따라해보는 windows 10 앱 개발
20150812 4시간만에 따라해보는 windows 10 앱 개발영욱 김
 
Behavioural Driven Development in Zf2
Behavioural Driven Development in Zf2Behavioural Driven Development in Zf2
Behavioural Driven Development in Zf2David Contavalli
 
Ultimate Productivity Tools
Ultimate Productivity ToolsUltimate Productivity Tools
Ultimate Productivity ToolsAmal Dev
 

Similar to Debugging Javascript - 0 to Heisenberg (20)

Debugging Javascript
Debugging JavascriptDebugging Javascript
Debugging Javascript
 
Debugger & Profiler in NetBeans
Debugger & Profiler in NetBeansDebugger & Profiler in NetBeans
Debugger & Profiler in NetBeans
 
Cucumber meets iPhone
Cucumber meets iPhoneCucumber meets iPhone
Cucumber meets iPhone
 
Release with confidence
Release with confidenceRelease with confidence
Release with confidence
 
Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)Plug yourself in and your app will never be the same (1 hr edition)
Plug yourself in and your app will never be the same (1 hr edition)
 
Tom Germeau: Mobile Apps: Finding the balance between performance and flexibi...
Tom Germeau: Mobile Apps: Finding the balance between performance and flexibi...Tom Germeau: Mobile Apps: Finding the balance between performance and flexibi...
Tom Germeau: Mobile Apps: Finding the balance between performance and flexibi...
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
413450-rc218-cdw-jenkins-workflow
413450-rc218-cdw-jenkins-workflow413450-rc218-cdw-jenkins-workflow
413450-rc218-cdw-jenkins-workflow
 
CoffeeScript, An Introduction for Nodejs developers
CoffeeScript, An Introduction for Nodejs developersCoffeeScript, An Introduction for Nodejs developers
CoffeeScript, An Introduction for Nodejs developers
 
ID E's features
ID E's featuresID E's features
ID E's features
 
Continous Delivering a PHP application
Continous Delivering a PHP applicationContinous Delivering a PHP application
Continous Delivering a PHP application
 
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven PignataroJoomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
 
React Native in Production
React Native in ProductionReact Native in Production
React Native in Production
 
Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...
Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...
Two Years, Zero servers: Lessons learned from running a startup 100% on Serve...
 
Real world Webapp
Real world WebappReal world Webapp
Real world Webapp
 
2011 py con
2011 py con2011 py con
2011 py con
 
Debugging with VS2019
Debugging with VS2019Debugging with VS2019
Debugging with VS2019
 
20150812 4시간만에 따라해보는 windows 10 앱 개발
20150812  4시간만에 따라해보는 windows 10 앱 개발20150812  4시간만에 따라해보는 windows 10 앱 개발
20150812 4시간만에 따라해보는 windows 10 앱 개발
 
Behavioural Driven Development in Zf2
Behavioural Driven Development in Zf2Behavioural Driven Development in Zf2
Behavioural Driven Development in Zf2
 
Ultimate Productivity Tools
Ultimate Productivity ToolsUltimate Productivity Tools
Ultimate Productivity Tools
 

Recently uploaded

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 

Recently uploaded (20)

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

Debugging Javascript - 0 to Heisenberg

  • 1.
  • 2. DEBUGGING JAVASCRIPT 0 TO HEISENBERG Chris Morrow Senior UI Developer Video screencast: http://youtu.be/-q1z8BPFItw
  • 5. THE PLAN JAVASCRIPT BEST PRACTICES (throughout) BREAKPOINTS WATCHES USING THE CONSOLE CALL STACK CUSTOM TOOLS / UNIT TESTING
  • 6. TOO MANY COOKS IN THE KITCHEN?
  • 7. BEST PRACTICES AVOID GLOBAL VARIABLES <script> var now = new Date(); /* more code goes here */ function doSomething(){ alert('the time is ' + now); } </script> /* code below can overwrite "now" var */ <script src="js/dateLibrary.js"></script>
  • 8. PROTECT YOUR VARIABLES WITH SCOPE <script> (function(){ // closure function var now = new Date(); /* more code goes here */ function doSomething(){ alert('the time is ' + now); } })(); </script> /* code below CAN'T change "now" var */
  • 9.
  • 10. WHY DO PEOPLE HATE DEBUGGING JS? VARIABLES ARE GLOBAL IN SCOPE NO REQUIRED STRONG TYPING CROSS BROWSER COMPATIBILITY (IE!!!) NO CLASSES
  • 11. DEBUGGING GOT YOU STRESSED?
  • 12. BREAKPOINTS NAVIGATING CODE STANDARD CONDITIONAL
  • 13. BREAKPOINTS Continue: continues code execution until we encounter another breakpoint Step Over: step through code line-by-line to get insights into how each line affects the variables being updated. Should your code call another function, the debugger won't jump into its code, instead stepping over so that the focus remains on the current function (scope). Step Into: like Step over, however clicking Step into at the function call will cause the debugger to move its execution to the first line in the functions definition. Step Out: having stepped into a function, clicking this will cause the remainder of the function definition to be run and the debugger will move its execution to the parent function
  • 16. ADDING A WATCH: MULTIPLE WAYS k Sources: select then right-click k Click "+" on Watch Expressions panel k Right-click inside Watch Expressions panel
  • 17. SCOPE VARIABLES k Like watches, but are only shown in scope
  • 18. AND NOW A QUICK MESSAGE FROM OUR SPONSOR...
  • 19.
  • 20. USING THE CONSOLE console.log() console.assert( expression, object ) console.table() Multiline Commands Snippets Live Editing
  • 21. BEST PRACTICES DO NOT MINIFY CODE IN DEVELOPMENT
  • 22.
  • 27. PRE-DEBUGGING TOOLS JSHint / JSLint JsHint is more lenient than JSLint.
  • 28. NOT HAPPY WITH JSHINT?
  • 29. CUSTO MIZE I T WITH .jshintrc
  • 30. UNIT TESTING QUnit: http://qunitjs.com/ Mocha: http://visionmedia.github.io/mocha/ Jasmine: http://jasmine.github.io/
  • 31. REMOTE TESTING ADOBE EDGE INSPECT
  • 32. RESOURCES / QUESTIONS? Chrome Dev Tools: https://developer.chrome.com/devtools Chrome Dev Tools: Tips & Tricks https://developer.chrome.com/devtools/docs/tips-and-tricks jQuery Learning Center: http://learn.jquery.com/javascript-101/ Design Patterns: http://addyosmani.com/resources/essentialjsdesignpatterns/book/ Douglas Crockford: Javascript the Good Parts http://javascript.crockford.com/