turbo-editors/turbo-jspublic Fork 0
v1.0.0
Commits
Clone
git clone https://git.rickub.com/turbo-editors/turbo-js.git
git clone ssh://git@rickub.com/turbo-editors/turbo-js.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

📦 Turbo JS 91999d1 · on v1.0.0 · k33g · 12h ago
greeter.js · 17 lines · 404 BJavaScript Blame HistoryRaw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
/** Greets one person, several times over. */
export class Greeter {
  #name;

  constructor(name) {
    this.#name = name;
  }

  /** Prints the greeting `times` times and says whether the name is capitalised. */
  greet(times = 1) {
    const pattern = /^[A-Z]/;
    for (let i = 1; i <= times; i++) {
      console.log(`Hello, ${this.#name}! (${i})`);
    }
    return pattern.test(this.#name);
  }
}