Advanced JS

Debugging



Just twitted the slides @jsdude005



www.thatJSDude.com / @jsdude005

Who is

JS Dude?

  • @jsdude005
  • Organize Chicago JavaScript meetup
  • Sr. Web Developer, Nielsen
  • Enjoy Learning, talking about JavaScript

Jump from 14,000ft

Chicago Marathon 2016

10,000 volts

Morning of a developer

Real morning

"Oh yeah"

App doesn't work

  • Can't add new record
  • Doesn't display all the records
  • Before start

    • Repro locally
    • Anything in console
    • Isolate the bug
    • Look at the data in network tab
    • Sort out of the options
    • Talk about how things were developed
    • Easy things first

    tools

    • spy.js
    • thesus by adobe
    • vorlon by MS

    Summary: Problem-1

    1. Elements Tab: Event Listeners
    2. Source Tab: Event Listener BreakPoints
    3. getEventListeners
    4. monitorEvent(element, [events])
    5. unmonitorEvents(element)
    6. Show function definition



    You are not done!

    one more problem to go

    Summary: Problem-2

    • Open file: cmd + P (Ctrl + P)
    • Filter function: Cmd + shift + O (Ctrl + shift + O)
    • console.table()
    • conditional breakpoint
    • Esc to open console
    • Live Edit
    • blackbox script

    Evening

    of a programmer

    Small pieces

    Style

    • Cmd + z (Ctrl + z)
    • class toggle
    • Edit Margin, Padding
    • color picker and color palette
    • Shift + Click: change color format
    • DOM search by css selctor

    Console tab

    • console.log
    • debug(), undebug()
    • keys(obj), values(obj)
    • monitor function
    • document.body.contentEditable = true
    • Preserve log


    command line API

    Source tab

    • Ctrl + G : Go to line
    • Cmd + option + F (ctrl + shift + F)
    • Break point in a long line
    • Matching Bracket: Ctrl + M
    • Cmd + Click: multi cursor
    • Cmd + D (ctrl + D): select next occurrence

    Async JS

    Full stack trace

    • setInterval
    • setTimeout
    • XMLHttpRequest
    • promises
    • requestAnimationFrame
    • MutationObservers
    • and more...


    debug Async JS

    XHR breakpoints

    Enable Async

    Summary: Network

    • filter by, "Method:GET", domain:google,
    • replay XHR
    • async
    • XHR breakpoint
    • Filmstrip recording
    • Copy a response
    • Network throttle

    snippet

    My fav - snippets

    • all globals
    • jquerify
    • all colors
    • view cookies
    • form controls


    devtools-snippet

    Extensions

    some extensions

    • web developer
    • Edit this cookie
    • JSON View
    • JSON formatter
    • Page speed insights
    • Visual Events
    • http headers
    • full page screen capture



    chrome web store

    others

    Easy and Useful



    dev tools tips

    Night of a developer

    Summary

    What we have talked

    1. monitor, unmonitor
    2. filter Functions (Ctrl + Shift + O)
    3. console.table
    4. async, XHR breakpoints
    5. Know dev tool

    Need more?

    Free tip

    Hotel Room

    • body lotion as shoe shiner
    • hair conditioner as shaving cream
    • hair dryer to dry wet shocks

    To be a better Developer

    • You have to be explore curiously
    • Learning interesting things
    • Build passion, experiment and enjoy
    • It's challenging...and it's a journey
    • You will accomplish a lot of fulfillments

    Learn by building

    I need more tips...

    www.youtube.com/c/thatjsdude

    Thank you

    Email: khan4019@gmail.com

    @jsdude005

    www.thatJSDude.com