Skip to content

Instantly share code, notes, and snippets.

Array (a collection of elements accessed by integer indices) is probably one of the most commonly used data structures by programmers, and slice is one of the most commonly used array methods. (This statistic also indicates that splice seems to be used more than we thought.)

Method Search Results
push more than 2913780 results from 110260 repositories
forEach 1303701 results from 94472 repositories
slice 743508 results from 76749 repositories
indexOf 621518 re
@hax
hax / README.md
Created January 18, 2022 12:52
Experimental API

NOTE: This proposal was mainly written 2 years ago, many examples may already outdated, but the whole idea should still apply.

Experimental API

Motivation

I have a dream, that the new JS APIs could be developed like good open source libraries, have reference implementation maintained by champions and volunteers in the whole lifecycle from stage 1 to stage 4, clearly marked as "experimental feature" not "polyfill", follow semver, and available in all platforms (all engines, browsers and node.js) automatically, accept issues and PRs in official github repo, can have branches to test new ideas, allow forks and healthy competition...

Problems

@hax
hax / channel.js
Created May 13, 2020 15:12
A experimental Channel in JS
// kotlin channel: https://kotlinlang.org/docs/reference/coroutines/channels.html
// golang channel
class Channel {
constructor() {
this._s = null
this._r = null
}
send(v) {
if (this._r) {
@hax
hax / iterator-with-message.md
Last active April 26, 2024 04:51
An idea from combination of `[...rest, last]` syntax, reverse iterator and `function.sent`