Search
KV Storage
1.4.2019
localStorage is...
Good! It's an incredibly easy API to use.
localStorage.setItem('name', 'Chris'); let name = localStorage.getItem('name');
Bad! Philip Walton explains why:
localStorage is a synchronous API that blocks the main thread, and any time you access it you potentially prevent your...
Collective #504
1.4.2019
CodeSandbox v3 * codetalks.tv * Name It, and They Will Come * code-server * oneliners.js * VexChords
Collective #504 was written by Pedro Botelho and published on Codrops
Differential Serving
1.4.2019
There is "futuristic" JavaScript that we can write. "Stage 0" refers to ideas for the JavaScript language that are still proposals. Still, someone might turn that idea into a Babel plugin and it could compile into code that can ship to any browser. For some of these lucky proposals, Stage 0 becomes...
Scroll-Linked Animations
29.3.2019
You scroll down to a certain point, now you want to style things in a certain way. A header becomes fixed. An animation triggers. A table of contents appears. To do anything based on scroll position, JavaScript is required right now. You watch the scroll position via a DOM event and alter...
You probably don’t need input type=“number”
29.3.2019
Brad Frost wrote about a recent experience with a website that used <input type="number">:
Last week I got a call from my bank regarding a wire transfer I had just scheduled. The customer support guy had me repeat everything back to him because there seemed to be a problem with...
Next Genpm
27.3.2019
So many web projects use npm to pull in their dependencies, for both the front end and back. npm install and away it goes, pulling thousands of files into a node_modules folder in our projects to import/require anything. It's an important cog in the great machine of web development.
While I don't...
Breaking CSS Custom Properties out of :root Might Be a Good Idea
27.3.2019
CSS Custom Properties have been a hot topic for a while now, with tons of great articles about them, from great primers on how they work to creative tutorials to do some real magic with them. If you’ve read more than one or two articles on the topic, then I’m sure you’ve noticed that they start...
JavaScript Glossary: String lastIndexOf()
27.3.2019
Basics
The lastIndexOf() method returns the last position within a String object which an element can be found. The search starts from the last position of the String object.
JavaScript Glossary: String startsWith()
27.3.2019
Basics
The startsWith method takes a string parameter and checks if the calling string starts with the value provided. It returns a Boolean value, true
JavaScript Glossary: String toLowerCase()
26.3.2019
Basics
The toLowerCase() String method converts a string object to lower case. The return value of the method is the value of the calling string in lower case
JavaScript Glossary: String length
26.3.2019
Basics
The length property of the String object returns the number of code points in a string object. It indicates the length of the string
An Illustrated (and Musical) Guide to Map, Reduce, and Filter Array Methods
26.3.2019
Map, reduce, and filter are three very useful array methods in JavaScript that give developers a ton of power in a short amount of space. Let’s jump right into how you can leverage (and remember how to use!) these super handy methods.
Array.map()
Array.map() updates each individual value in...
Understanding Event Emitters
26.3.2019
Consider, a DOM Event:
const button = document.querySelector("button");
button.addEventListener("click", (event) => /* do something with the event */)
We added a listener to a button click. We’ve subscribed to an event being emitted and we fire a callback when it does. Every time we click that...
JavaScript Glossary: String indexOf()
25.3.2019
Basics
This method checks for the first appearance of a provided string argument within the calling string and returns the index. It returns -1 if the string argument can’t be
Set Commit Author with git or hg
24.3.2019
Knowing who authored a code patch is a sacred and important practice in the world of software engineering. Knowing the author gives the reviewer an idea of trust level, know who to ask questions about the patch, and gives credit to the genius of an important fix. There have been times when...
All About mailto: Links
22.3.2019
You can make a garden variety anchor link (<a>) open up a new email. Let's take a little journey into this feature. It's pretty easy to use, but as with anything web, there are lots of things to consider.
The basic functionality
<a href="mailto:someone@yoursite.com">Email...
Using <details> for Menus and Dialogs is an Interesting Idea
21.3.2019
One of the most empowering things you can learn as a new front-end developer who is starting to learn JavaScript is to change classes. If you can change classes, you can use your CSS skills to control a lot on a page. Toggle a class to one thing, style it this way, toggle to another class...
Blurred Borders in CSS
20.3.2019
Say we want to target an element and just visually blur the border of it. There is no simple, single built-in web platform feature we can reach for. But we can get it done with a little CSS trickery.
Here's what we're after:
The desired result.
Let's see how we can code this effect, how we...
Creating a Custom Element from Scratch
20.3.2019
In the last article, we got our hands dirty with Web Components by creating an HTML template that is in the document but not rendered until we need it.
Next up, we’re going to continue our quest to create a custom element version of the dialog component below which currently only uses...
JavaScript Glossary: String includes()
19.3.2019
Basics
The includes method checks a provided string against the calling String object, it returns true if the calling String object contains the provided string a