hello.js

var please = require('share');
console.log('thank you');

NEW !!!

Tuesday, 6 February, 2024 UTC

Detect Caps Lock with JavaScript

Anyone is capable of having their caps lock key on at any given time without realizing so. Users can easily spot unwanted caps lock when typing in most inputs, but when using a password input , the problem isn’t so obvious. That leads to the user’s password ... more


Wednesday, 24 January, 2024 UTC

Fixing Cumulative Layout Shift Problems on DavidWalshBlog

Over 50 thousand developers visit DavidWalshBlog every month from around the world to learn JavaScript tricks and fix problems in their code. Unfortunately, some of them have a slow experience on the site. David tracks the performance of his Core Web ... more


Tuesday, 16 January, 2024 UTC

Extract a Number from a String with JavaScript

User input from HTML form fields is generally provided to JavaScript as a string. We’ve lived with that fact for decades but sometimes developers need to extract numbers from that string. There are multiple ways to get those numbers but let’s rely on ... more


Monday, 23 October, 2023 UTC

AutoSave with VSCode

Visual Studio Code has taken the crown of most used text editor, at least in JavaScript spheres. VSCode is fast, feature-filled, and supports thousands of plugins to boost productivity. Developers can also tweak hundreds of settings to enrich functionality. ... more


Thursday, 7 September, 2023 UTC

Sum an Array of Numbers with JavaScript

It’s rare that I’m disappointed by the JavaScript language not having a function that I need. One such case was summing an array of numbers — I was expecting Math.sum or a likewise, baked in API. Fear not — summing an array of numbers is easy using Array.prototype.reduce ... more


Monday, 14 August, 2023 UTC

JavaScript waitFor Polling

As more of the JavaScript developers write becomes asynchronous, it’s only natural to need to wait for conditions to be met. This is especially true in a world with asynchronous testing of conditions which don’t provide an explicit await . I’ve written ... more


Friday, 11 August, 2023 UTC

queryLocalFonts

One of the larger downloads when requesting a webpage are custom fonts. There are many great techniques for lazy loading fonts to improve performance for those on poor connections. By getting insight into what fonts the user has available, we can avoid ... more


Monday, 17 July, 2023 UTC

URL.canParse

Parsing of URLs on the client side has been a common practice for two decades. The early days included using illegible regular expressions but the JavaScript specification eventually evolved into a new URL method of parsing URLs. While URL is incredibly ... more


Wednesday, 5 July, 2023 UTC

JavaScript closest

When it comes to finding relationships between elements, we traditionally think of a top-down approach. We can thank CSS and querySelector / querySelectorAll for that relationship in selectors. What if we want to find an element’s parent based on selector? ... more


Monday, 26 June, 2023 UTC

JavaScript: Reverse Arrays

Manipulating data is core to any programming language. JavaScript is no exception, especially as JSON has token over as a prime data delivery format. One such data manipulation is reversing arrays. You may want to reverse an array to show most recent ... more


Monday, 12 June, 2023 UTC

Confessions of a Web Developer XX

It’s been quite a while since I’ve gotten a few things off of my chest and since I’m always full of peeves and annoyances I thought it was time to unleash: One day you’re getting recruited by another crypto wallet vendor, the next their users are getting ... more


Monday, 17 April, 2023 UTC

JavaScript Array Group

Managing, sorting, and manipulating data with JavaScript is a skill we’ve often delegated to third party libraries like lodash. As the JavaScript language progresses, however, these features eventually get. added to the JavaScript specification. Two ... more


Thursday, 13 April, 2023 UTC

How to Get a Base64 Version of a File From Command Line

A while back I wrote an article on how to Convert Image to Data URI with JavaScript. It’s a neat trick developers can use for any number of reasons. Instead of abusing canvas, however, why not simply get the base64 data from command line? You can use ... more


Monday, 6 March, 2023 UTC

Detect the Content Type in the Clipboard

A user’s clipboard is a “catch all” between the operating system and the apps employed on it. When you use a web browser, you can highlight text or right-click an image and select “Copy Image”. That made me think about how developers can detect what ... more


Monday, 16 January, 2023 UTC

fetch with Timeout

A few years back I wrote a blog post about how write a fetch Promise that times out. The function was effective but the code wasn’t great, mostly because AbortController , which allows you to cancel a fetch Promise, did not yet exist. With AbortController ... more


Monday, 9 January, 2023 UTC

Customizing HTML Form Validation

Form validation has always been my least favorite part of web development. You need to duplicate validation on both client and server sides, handle loads of events, and worry about form element styling. To aid form validation, the HTML spec added some ... more


Tuesday, 3 January, 2023 UTC

How to Determine a JavaScript Promise’s Status

Promises have changed the landscape of JavaScript. Many old APIs have been reincarnated to use Promises (XHR to fetch, Battery API), while new APIs trend toward Promises. Developers can use async / await to handle promises, or then / catch / finally ... more


Monday, 2 January, 2023 UTC

Detect XR Support with JavaScript

A few years ago I wrote an article about how to detect VR support with JavaScript. Since that time, a whole lot has changed. “Augmented reality” became a thing and terminology has moved to “XR”, instead of VR or AR. As such, the API has needed to evolve. ... more


Saturday, 31 December, 2022 UTC

Document.elementFromPoint

Reacting to events with JavaScript is the foundation of a dynamic experiences on the web. Whether it’s a click event or another typical action, responding to that action is important. We started with assigning events to specific elements, then moved ... more


Friday, 30 December, 2022 UTC

JavaScript print Events

Media queries provide a great way to programmatically change behavior depending on viewing state. We can target styles to device, pixel ratio, screen size, and even print. That said, it’s also nice to have JavaScript events that also allow us to change ... more


Friday, 30 December, 2022 UTC

Detect Browser Bars Visibility with JavaScript

It’s one thing to know about what’s in the browser document, it’s another to have insight as to the user’s browser itself. We’ve gotten past detecting which browser the user is using, and we’re now into knowing what pieces of the browser UI users are ... more


Tuesday, 27 December, 2022 UTC

How to Control CSS Animations with JavaScript

When it comes to animations on the web, developers need to measure the animation’s requirements with the right technology — CSS or JavaScript. Many animations are manageable with CSS but JavaScript will always provide more control. With document.getAnimations ... more


Monday, 21 November, 2022 UTC

How to Internationalize Numbers with JavaScript

Presenting numbers in a readable format takes many forms, from visual charts to simply adding punctuation. Those punctuation, however, are different based on internationalization. Some countries use , for decimal, while others use . . Worried about having ... more


Monday, 31 October, 2022 UTC

How to Extend Prototypes with JavaScript

One of the ideological sticking points of the first JavaScript framework was was extending prototypes vs. wrapping functions. Frameworks like MooTools and Prototype extended prototypes while jQuery and other smaller frameworks did not. Each had their ... more


Wednesday, 26 October, 2022 UTC

Convert Fahrenheit to Celsius with JavaScript

The United States is one of the last bodies that refuses to implement the Celsius temperature standard. Why? Because we’re arrogant and feel like we don’t need to change. With that said, if you code for users outside the US, it’s important to provide ... more


Monday, 24 October, 2022 UTC

Detect System Theme Preference Change Using JavaScript

JavaScript and CSS allow users to detect the user theme preference with CSS’ prefers-color-scheme media query. It’s standard these days to use that preference to show the dark or light theme on a given website. But what if the user changes their preference ... more


Monday, 10 October, 2022 UTC

Skip or Only Run a Test with JavaScript Mocha

Whenever I start to feel anxiety about a big change I’m making, I start writing more unit tests. I’ll write down my fear and then write a test that attacks, and eventually relaxes, that fear. There are two actions that I’ve been frequently using with ... more


Monday, 22 August, 2022 UTC

CSS :out-of-range

One aspect of web development I’ve always loathed was working with forms. Form elements have been traditionally difficult to style due to OS and browser differences, and validation can be a nightmare. Luckily the native HTML APIs added methods for improving ... more


Tuesday, 2 August, 2022 UTC

How Plugins Enhance The WYSIWYG Editing Experience (Sponsored)

Image by JK_Studio from Pixabay WYSIWYG editors are one of the core components of any content management system (CMS). A well-coded, feature-filled WYSIWYG HTML editor can distinguish between a CMS users love and one they can’t stand. While all WYSIWYG ... more


Wednesday, 27 July, 2022 UTC

JavaScript Event.defaultPrevented

Whether you started with the old on_____ property or addEventListener , you know that events drive user experiences in modern JavaScript. If you’ve worked with events, you know that preventDefault() and stopPropagation() are frequently used to handle ... more