{ Javascript snippets }

R. Alex Anderson ?

R. Alex Anderson ? @ralex1993

??? #JavaScript tip: Reduce an array of constants into an object to save yourself a couple lines of code. I'm using linear interpolation here to create an array of x,y,z values from a location, destination, and the movement time. https://t.co/0wlocaJLWu

Daily Web Dev

Daily Web Dev @dailywebdev

A handy little debugging trick you can use in javascript is throwing exceptions to provide descriptive error messages in the console. throw new Error('hello world') ? You can take this one step further by throwing a variable directly (works with all datatypes) #javascript #js https://t.co/BLm2L6A4Qp

R. Alex Anderson ?

R. Alex Anderson ? @ralex1993

??? Tip: awaiting is an execution-blocking operation, as in the rest of the function won't execute until the awaited promise is resolved. Run promises concurrently by awaiting references to the already executed promises! (You can also do this with Promise.all()) https://t.co/Vp1C6pOXkJ

Katie Hempenius

Katie Hempenius @katiehempenius

How to view your connection speed from DevTools: > window.navigator.connection - This is the "NetworkInformation API" - It returns bandwidth, latency, & connection type approximations? https://t.co/nlCTIWiaTH

JavaScript Teacher

JavaScript Teacher @js_tut

Type in Chrome console: const obj = { } Then type: copy( obj ); Result: const obj = { } will be copied to clipboard. Paste it into your text editor. Works with any currently defined object. Makes debugging a lot easier – used it 1000+ times @ work.

Wes Bos

Wes Bos @wesbos

? If you are trying to debug something in the middle of chaining array methods, just map over it, console.log, and return it. Since console.log returns nothing, it will just pass the entire array through. You can even make a handle little debug function ? https://t.co/HCtLh4QYm6

TIL: `document.getElementsByClassName()` & Co return _live_ `NodeList`s. `document.querySelectorAll()` returns a _static_ `NodeList`. Use `querySelectorAll()`, people! https://t.co/s7aGuxMGgN