kuniga.me > Docs > Python Cheatsheet
Syntax for common tasks I run into often. Tested in Google Chrome 102 (circa 2022-05).
Fixed size:
const arr = new Array(10);keywords: insert, append
Append to the end:
arr.push(e)let s = 0
arr.forEach(e => s += e);keywords: length
arr.lengthEmpty:
const s = new Set();From Array:
const s = new Set([1, 2]);keywords: insert, append
s.add(x);for (let e of s) {
print(e);
}s.has(x);s.delete(x);$O(1)$:
const first = s.values().next().value;