#lua

1 post in this collection

Emerging JavaScript pattern: multiple return values

In this article, I want to explore an interesting pattern that I am seeing more and more in JavaScript code which allows you to return multiple values from a function. You probably know already that JavaScript does not support multiple return values natively, so this article will actually explore some ways to “simulate” this behavior. One of the most famous usages of this pattern I have seen recently is within React Hooks , but before delving into that, let’s see what I mean with “multiple return values…