Skip to content
jshacks.dev

Tag

patterns

2 posts

Flat illustration of two options weighed side by side, with the JavaScript, Vite and Node.js logos.
Functions

Classes vs Factory Functions

Classes vs factory functions in JavaScript compared on private state, this, instanceof, inheritance, memory, JSON and testing, with exact output.

7 min read
Flat illustration of a test run shown as a row of passing dots, with the Vitest, Mocha, Cypress and Jest logos.
Testing

Arrange, Act, Assert

Arrange, Act, Assert splits a test into setup, one action and checks. See it in Vitest with builders, async tests, common mistakes and variants.

7 min read