Search

Nalezeno "javascript": 273

Getting To Know The MutationObserver API


MutationObserver watches the DOM, specifically the places you tell it to, like: document.querySelector('#watch-this'); ...and it can tell you (trigger a callback) when stuff happens — like when a child is added, removed, changed, or a number of other things. I used it just the other day...

Type Conversion with JavaScript Arrays


JavaScript’s loose nature allows developers to employ amazing tricks to do just about anything you’d like. I’ve detailed how you can filter falsy values in arrays using a filter(Boolean) trick, but reader David Hibshman shared another trick for typecasting array values the same...

Flow Object.values(…)


JavaScript typing utilities, like Flow and TypeScript, have become popular in JavaScript apps of all sizes. As I mentioned in our Script & Style Show typing podcast, typing is a great way to implicitly implement documentation and validation. Flow isn’t always easy to perfect, however,...

JavaScript Detect Async Function


JavaScript async/await has changed the landscape of how we code. We’re no longer stuck in callback or then hell, and our code can feel more “top down” again. Async functions require the following syntax: async function myFunction() { } To use await with a function, the function...

7 Useful JavaScript Tricks


Just like every other programming language, JavaScript has dozens of tricks to accomplish both easy and difficult tasks. Some tricks are widely known while others are enough to blow your mind. Let’s have a look at {x} JavaScript tricks you can start using today! Get Unique Values of an Array...

In Defense of the Ternary Statement


Some months ago I was on Hacker News (as one does) and I ran across a (now deleted) article about not using if statements. If you’re new to this idea (like I was), you’re in a for a real treat. Just search for "if statements" on Hacker News. You'll get articles proposing that you might not need...

Undefined: The Third Boolean Value


I wanted to implement a notification message in one of my projects, similar to what you’d see in Google Docs while a document is saving. In other words, a message shows up indicating that the document is saving every time a change is made. Then, once the changes are saved, the message becomes: “All...

Používáme knihovnu Readability na serveru


Možná znáte Readability z reader-view v prohlížeči. Odstraní ze stránky přebytečný balast a zůstane jen dobře čitelný text. Stejný projekt lze s úspěchem použít i na serveru. Pojďme si ukázat, proč i servery potřebují dobře čitelné texty

Yet Another JavaScript Framework


On March 6, 2018, a new bug was added to the official Mozilla Firefox browser bug tracker. A developer had noticed an issue with Mozilla's nightly build. The report noted that a 14-day weather forecast widget typically featured on a German website had all of a sudden broken and disappeared. Nothing...

A historical look at lowercase defaultstatus


Browsers, thank heavens, take backward compatibility seriously. Ancient websites generally work just fine on modern browsers. There is a way higher chance that a website is broken because of problems with hosting, missing or altered assets, or server changes than there is with changes in...

Differential Serving


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...

An Illustrated (and Musical) Guide to Map, Reduce, and Filter Array Methods


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


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...

Build a Decentralized Web Chat in 15 Minutes


In this 15 minute tutorial we’re going to build a simple decentralized chat application which runs entirely in a web browser. All you will need is a text editor, a web browser, and a basic knowledge of how to save HTML files and open them in the browser. We’re going...

Adding Search to Your Site with JavaScript


Static website generators like Gatsby and Jekyll are popular because they allow the creation of complex, templated pages that can be hosted anywhere. But the awesome simplicity of website generators is also limiting. Search is particularly hard. How do you allow users to search when you have...

Get Started with Node: An Introduction to APIs, HTTP and ES6+ JavaScript


Jamie Corkhill has written this wonderful post about Node and I think it’s perhaps one of the best technical articles I’ve ever read. Not only is it jam-packed with information for folks like me who aren't writing JavaScript everyday, it is also incredibly deliberate as Jamie slowly walks through...

Styling Based on Scroll Position


Rik Schennink documents a system for being able to write CSS selectors that style a page when it has scrolled to a certain point. If you're like me, you're already on the lookout for document.addEventListener('scroll' ... and being terrified about performance. Rik gets to that right away by both...

The Bottleneck of the Web


Steve Souders, "JavaScript Dominates Browser CPU": Ten years ago the network was the main bottleneck. Today, the main bottleneck is JavaScript. The amount of JavaScript on pages is growing rapidly (nearly 5x in the last 7 years). In order to keep pages rendering and feeling fast, we need to focus...

JavaScript Proxy


I’ve always loved the flexibility of Objects and prototypes in JavaScript, but for a long time, I felt that a level of dynamism was lacking. JavaScript eventually added get and set methods for object properties, which was an awesome step, but there was still room for improvement....

Nahoru
Tento web používá k poskytování služeb a analýze návštěvnosti soubory cookie. Používáním tohoto webu s tímto souhlasíte. Další informace