Skip to content

Instantly share code, notes, and snippets.

@DazzGranto
DazzGranto / range.js
Last active May 29, 2024 01:31
Range in JavaScript (Sequence generator)
// Sequence generator function (commonly referred to as "range", e.g. Clojure, PHP etc)
const range = (start, stop, step = 1) => Array.from({ length: (stop - start) / step + 1}, (_, i) => start + (i * step));
// Generate numbers range 0..4
range(0, 4);
// [0, 1, 2, 3, 4]
// Generate numbers range 1..10 with step of 2
range(1, 10, 2);
// [1, 3, 5, 7, 9]
@orta
orta / me.txt
Last active June 19, 2023 12:09
whoami
Since 2013 I've worked entirely in the open, lowering the barriers to different
developer ecosystems as one of the most active users on GitHub.
I've helped big OSS projects with design, project management and occasionally code.