Skip to content

Instantly share code, notes, and snippets.

View vpellegrino's full-sized avatar
👨‍🎤
License MIT - do anything with the code, but don't blame me if it does not work.

Valentino Pellegrino vpellegrino

👨‍🎤
License MIT - do anything with the code, but don't blame me if it does not work.
View GitHub Profile
@getify
getify / 1-CalendarItem.js
Last active March 21, 2024 09:11
an illustration (non-trivial example) of many newer JS class features
// abstract class, not intended to be instantiated directly
class CalendarItem {
static #UNSET = Symbol("unset")
static #isUnset(v) {
return v === this.#UNSET;
}
static {
for (let [idx,msg] of [
"ID is already set.",
"ID is unset.",