This book dives deeply into JavaScript:

  • It teaches practical techniques for using the language better.

  • It teaches how the language works and why. What it teaches is firmly grounded in the ECMAScript specification (which the book explains and refers to).

  • It covers only the language (ignoring platform-specific features such as browser APIs) but not exhaustively. Instead, it focuses on a selection of important topics.

Your complaints of x == y behaviors being weird, buggy, or downright broken have all blamed == as the culprit. No, it’s really not. == is pretty helpful, actually.

The problems you’re having are not with the == operator itself, but with the underlying values and how they coerce to different types, especially in the weird corner cases.

Instead of fixing your problems by avoiding == (and always using ===), we should focus our efforts on either avoiding—or fixing!—the corner case value coercions. Indeed, those are where all the WTFs really come from.

Read More

Since its inception in 2013, React has rolled out a robust set of tools to help relieve developers of some of the minutiae of creating web applications and allow them to focus on what matters.

Despite React’s many features and consistent popularity among developers, however, I have found time and again that many of us ask the same question: How do we handle complex state using React?

In this article we’ll investigate what state is, how we can organize it, and different patterns to employ as the complexity of our applications grow.

Read More

“Tree-shaking” is a must-have performance optimization when bundling JavaScript. In this article, we dive deeper on how exactly it works and how specs and practice intertwine to make bundles leaner and more performant. Plus, you’ll get a tree-shaking checklist to use for your projects.

We’ve been incredibly impressed and inspired by https://ciechanow.ski/cameras-and-lenses/ by Bartosz Ciechanowski. He did such an incredible job. And it appears he did it all with raw javascript. Javascript is very freeing once you decide to ignore any kind of build system or awful library. And some of the features of modern javascript are rather nice https://javascript.info/.

We had very grandiose plans, but we’ve gotten bogged down, so I’ve decided to dump out a post of what we have as a checkpoint. It’s nice to know when to give up.

The code for all of these is here https://github.com/Smung-Institute/infinite-darkness

To start we made a ray of light bounce off a mirror controlled by a slider. https://github.com/Smung-Institute/infinite-darkness/blob/master/mirror.html This was built unsytematically as a one off..

Read More

Recently, I started a new role as a Software Engineer at Reify Health. Unlike any other role that I have had, a huge part of our product stack is written in Clojure and ClojureScript. Thankfully, I have spent my last few years as a JS/TS dev working with React and as a result, have employed and appreciated a very functional style. ClojureScript has unlocked whole new levels of productivity in JavaScript and React. Particularly, it has shut the door on patterns that are pain points and allowed for new paradigms that JavaScript did not elegantly allow one to express.

Read More

At Replit, our mission is to make programming more accessible. We provide people with free compute in the cloud so that they can build apps on any device. Among the most popular ways to create apps on the web today is React. Historically, however, React tooling has been slow on Replit. While the JavaScript ecosystem has produced excellent tools for professional developers, many of the most popular ones, like Create React App and Webpack, have become increasingly complex and inefficient.

Fortunately, we’ve seen the JavaScript community recognize this problem and move to build faster and more efficient tooling, which means we can finally deliver the experience our users expect from us.

Read More

David Beazley thought that “JavaScript versus Data Science” would be a better title for this book. While that one word sums up how many people view the language, we hope we can convince you that modern JavaScript is usable as well as useful. Scientists and engineers are who we were thinking of when we wrote this book but we hope that these lessons will also help librarians, digital humanists, and everyone else who uses computing in their research.

We will cover:

  • Core features of modern JavaScript

  • Programming with callbacks and promises

  • Creating objects and classes

  • Writing HTML and CSS

  • Creating interactive pages with React

  • Building data services

  • Testing

  • Data visualization

  • Combining everything to create a three-tier web application

Unlike most introductions to JavaScript, these lessons present an even mix of browser programming and server programming. We give each topic only shallow coverage; if you want to know more, there are many other free tutorials you can dive into once you’ve mastered the basics, some of which are both up-to-date and well designed.

Read More

JavaScript allows calling a function with a different number of arguments than the expected number of parameters, i.e., one can pass fewer or more arguments than the declared formal parameters. The former case is called under-application and the latter is called over-application.

In the under-application case, the remaining parameters get assigned the undefined value. In the over-application case, the remaining arguments can be accessed by using the rest parameter and the arguments property, or they are simply superfluous and they can be ignored. Many Web/NodeJS frameworks nowadays use this JS feature to accept optional parameters and create a more flexible API.

Until recently, V8 had a special machinery to deal with arguments size mismatch: the arguments adaptor frame. Unfortunately, argument adaption comes at a performance cost, but is commonly needed in modern front-end and middleware frameworks. It turns out that, with a clever trick, we can remove this extra frame, simplify the V8 codebase and get rid of almost the entire overhead.

We can calculate the performance impact of removing the arguments adaptor frame through a micro-benchmark.

Read More

Vue Native is a framework to build cross platform native mobile apps using JavaScript

After trying out Deno I got passionate about it. This post introduces my first Deno module, a simple preprocessor for HTML files that runs Deno where the new <deno> tag is specified. How useful can a simple file preprocessor be? What can it help build?

When explaining a technology, we have to decide how to approach its shortcomings. There might be mistakes in its design, or it might have usability problems, or it might be unreliable. How do we approach these and how much emphasis do we place on them?

One approach is: “This tool has a lot of problems, but we’ll show you how to avoid them.” That can demotivate the learner: “Why am I learning this thing if it has so many problems?”

Javascript

Share and discuss the Javascript programming language.

Created on Oct 23, 2020
By @root