JavaScript Tutorials
Monitor Events and Function Calls via Console
Despite having worked on the very complex Firefox for a number of years, I'll always love plain old
console.log
debugging. Logging can provide an audit trail as events happen and text you can share with others. Did you know that chrome providesmonitorEvents
and...Specify Node Versions with .nvmrc
I've heavily promoted nvm, a Node.js version manager, over the years. Having a tool to manage multiple versions of a language interpreter has been so useful, especially due to the complexity of Node.js package management.One tip I like to give new developers is adding a...
How to Inject a Global with Web Extensions in Manifest V3
For those of you not familiar with the world of web extension development, a storm is brewing with Chrome. Google will stop support for manifest version 2, which is what the vast majority of web extensions use. Manifest version 3 sees many changes but the largest...
JavaScript Event.defaultPrevented
Whether you started with the old
on_____
property oraddEventListener
, you know that events drive user experiences in modern JavaScript. If you've worked with events, you know thatpreventDefault()
andstopPropagation()
are frequently used to handle events. One thing you probably didn't know: there's adefaultPrevented
...How to Get Extension Manifest Information
Working on a web extension can be kinda wild -- on one side you're essentially just coding a website, on the other side you're limited to what the browser says you can do in the extension execution environment. One change in that environment is coming...
Get a Random Array Item with JavaScript
JavaScript Arrays are probably my favorite primitive in JavaScript. You can do all sorts of awesome things with arrays: get unique values, clone them, empty them, etc. What about getting a random value from an array?To get a random item from...
Legacy String Methods for Generating HTML
I'm always really excited to see new methods on JavaScript primitives. These additions are acknowledgement that the language needs to evolve and that we're doing exciting new things. That being said, I somehow just discovered some legacy String methods that you probably shouldn't use...
Interview with an Intiface Haptics Engineer
I was recently re-reading my Interview with a PornHub Web Developer and one bit I started thinking about was the VR question and the idea of making users not just see but feel` something. The haptic feedback of VR games is what really sets...
Input valueAsNumber
Every once in a while I learn about a JavaScript property that I wish I had known about years earlier --
valueAsNumber
is one of them. ThevalueAsNumber
provides the value of aninput[type=number]
as a Number type, instead of the traditional string representation when...Detect Dark Mode Preference with JavaScript
Seemingly every website, dapp, and app offers a dark mode preference, and thank goodness. Dark mode is especially useful when I'm doing late night coding, or even worse, trading into altcoins. I'm presently working on implementing a dark theme on MetaMask and it got...