Ben Nadel showcases the style.setProperty() method in JavaScript. This allows you to update CSS styles; but, unlike mutating the style object directly, the .setProperty() method allows you to keep your CSS names consistent in both CSS and JavaScript.... ... more
Ben Nadel demonstrates how to use the Element.matches() method in JavaScript to see if a given element has a CSS pseudo-class being applied to it. This covers pseudo-classes like ":hover" and ":active" as well as things like, ":-webkit-autofill".... ... more
Ben Nadel demonstrates how to implement a "show password" checkbox on a login form using JavaScript. This allows the user to change the password field from an obfuscated input to a plain-text input in order to make it easier to see what password ... more
Ben Nadel looks at prompting text downloads by converting plain-text values into Blobs, creating Blob URIs with the URL.createObjectURL() method, and then attaching said Blob URIs to anchor tags with "download" attributes.... ... more
Ben Nadel demonstrates that the timezone portion of the Date .toTimeString() method in JavaScript is not always represented as an abbreviation. Therefore, if you're parsing the time string to extract the timezone, you may have to use a more flexible ... more
Ben Nadel looks at how to automatically scroll the browser window when the user's mouse approaches the edge of the viewport in JavaScript. This is primarily a note-to-self; but, it may serve as help for others.... ... more
Ben Nadel considers the use of markdown in his comments; and, how he can greatly increase the usability of the commenting textarea by enabling tabbing features (Tab, Shift+Tab, Enter, Shift+Enter) while the user is editing a fenced code-block.... ... more
Ben Nadel uses a cryptographically secure pseudo-random number generator (CSPRNG) in Node.js to randomly select the winners of the 2018 RegEx Day celebrations.... ... more
Ben Nadel discovers that Data URI payloads do not have to be Base64-encoded when dealing with plain-text content. And, that this feature can provide a very easy way to prompt custom file downloads in JavaScript, using the anchor "download" ... more
Ben Nadel digs into the jQuery source and discovers that the various "append" methods intercept Script Tags and load the requested SRC locations using AJAX. This bypasses any "onload" event handlers; and, fails silently in the jQuery ... more
Ben Nadel considers the haphazard use of Environment Variables in Node.js applications (or any application for that matter). He equates them to "global state"; and reflects on why using them incurs a host of problems with regard to the long-term ... more
Ben Nadel looks are RxJS in the context of Zone.js and Angular's change-detection algorithm. And, explores the patch files that Zone.js provides for making 3rd-party libraries, like RxJS, zone-aware.... ... more
Ben Nadel reviews Functional-Light JavaScript by Kyle Simpson. Kyle has an effortless writing style and a knack for breaking down complex concepts into bite-sized pieces which he can then use to construct an increasingly-sophisticated and multi-faceted ... more
Ben Nadel explains why choosing Angular as your application framework will turn you into a ninja rockstar unicorn 10x JavaScript developer! Not only will Angular force you to learn more JavaScript; but, the underlying Dependency-Injection system will ... more
Ben Nadel performs a sanity-check exploration of Zone.js bindings in Angular 5.2.10, confirming that handlers bound within handlers that were, themselves, bound outside of the Angular Zone will all use the same zone instance and bypass Angular's change-detection ... more
Ben Nadel talks about the three phases of Event handling on the DOM (Document Object Model); and, how we can track IMG Error events using Event Delegation if we observe the Capture phase, not the Bubble phase.... ... more
Ben Nadel takes his first independent foray into Docker, creating a simple "hello world" site using Docker, node.js, nginx, DataDog, DogStatsD, and LetsEncrypt for SSL certificates, all deployed on DigitalOcean using Docker Hub as an image ... more
Ben Nadel demonstrates that stack-traces (error.stack) in Node.js point to the line of code on which the Error() object was created - not to the point in the control flow in which the error is actually thrown. If not understood, this can lead to obfuscated ... more
Ben Nadel remembers the theme song from the Official jQuery Podcast. This song (by Jonathan Neal) always used to leave me smiling after every episode.... ... more
Ben Nadel disputes the claim that frameworks and libraries prevent people from learning JavaScript. In fact, he argues the opposite: frameworks and libraries can make you a much better developer, forcing you to think differently and more deeply about ... more
Ben Nadel documents some Type Declaration strategies for his own use in future TypeScript projects. This allows him to provide type-safety for ".js" files that he needs to consume alongside the rest of his TypeScript code.... ... more
Ben Nadel shares the struggle he has with mentally parsing double-parentheses - ()() - which is a common syntax in the JavaScript and Node.js communities. Such expressions require more cognitive load than his caveman brain is able to provide.... ... more
Ben Nadel looks at the mysterious "new" operator in JavaScript. And, attempts to build a mental model that makes it easy to understand when and why JavaScript will apply the "new" operator to a compound expression containing member ... more
Ben Nadel explores JavaScript's String.prototype.split() method, which will return the delimiters in the result-set if the given Regular Expression pattern uses a capturing group. This provides some new and fun ways to parse strings.... ... more
Ben Nadel demonstrates how to use Firebase 4 with TypeScript and type declarations. When using npm to load the Firebase module, the type definition file ships with the module itself.... ... more
Ben Nadel demonstrates how to aggregate and package cherry-picked Lodash methods in an application module in JavaScript. This results in smaller bundles without sacrificing cohesive package mental models. And, makes it easier to keep versioned vendor ... more
Ben Nadel reflects on JavaScript linting after having used it for the first time in his career. From what he can see, linting is an all pain no gain kind of standard that adds an arbitrary layer of friction to the already-hard problem solving landscape.... ... more
Ben Nadel discusses JavaScript ability to use relative values when instantiating or modifying Date objects. And, how this relative-date magic can be used to easily calculate how many days are in a given month.... ... more
Ben Nadel demonstrates how to write Bookmarklets that are hosted on GitHub Pages. And, shares several of the Bookmarklets that he's created for Loggly that add better formatting and on-the-fly JSON (JavaScript Object Notation) parsing.... ... more
Ben Nadel demonstrates that you can use Arrays in direct field comparisons when writing Sequelize WHERE clauses. This is a construct that you might otherwise delegate to the "$in" operator. However, we can skip the nested object and create ... more