Articles tagged in: JavaScript



JavaScript — Get Battery Status

Browsers become powerful when it comes to interacting with the user’s system. For example, the Battery API allows you to retrieve information about the system’s battery charge level. You may check whether a device is charging and has enough energy. This tutorial shows you how to retrieve the …

Continue Reading

JavaScript — Test for LocalStorage Support

One of our projects serves thousands of users every day. The users are non-technical and have all sorts of technical devices. The devices may be old and outdated, but they’re still used. We need to ensure the website works on such devices too. All major browsers support localStorage. It’ …

Continue Reading

JavaScript — How to JSON Stringify Errors

You can create a JSON string from anything in JavaScript using the JSON.stringify(anything) method. However, the resulting JSON string may not contain the expected values. For example, if you’re JSON serializing a JavaScript error, you’ll notice that its JSON string doesn’t contain any properties. JavaScript …

Continue Reading

JavaScript — Using the new Array Grouping Methods

Grouping array items is a common task in programming. You probably wrote a JavaScript grouping function multiple times in your projects. And in the future, you don’t necessarily have to do it again. JavaScript is getting support for array grouping with the static Object.groupBy and Map.groupBy methods. …

Continue Reading

JavaScript — Create Array from AsyncIterable

JavaScript has supported async iterators since ES2018. All modern browser versions handle async iterables and Node.js can do it since version 10.x. Async iterables have a positive aspect and a drawback at the same time: you need to consume them to know the result. That means you can’ …

Continue Reading

JavaScript — Cache Computation Results in a Local Variable

We’re using a small performance optimization in our code bases: caching computation results in local variables. Saving results in a local variable is borrowed from the memoization technique. Memoizing values improves the performance of function execution by storing the results and reusing them for a function call. This tutorial …

Continue Reading
Page 1 of 14

Explore the Library

Find interesting tutorials and solutions for your problems.