Skip to content

Counter

TypeScript class method

Same task in: JavaJavaScript

Flowchart (ISO 5807)

Startthis.value = this.value + 1EndFigure 1 — Counter.inc

Source code

TypeScript
class Counter {
    value = 0;
    inc(): void {
        this.value++;
    }
}

The editor opens with this code — change it and the chart redraws.

Language
TypeScript
Constructs
class method
Topic
Classes & methods
Formats
Word, Visio, draw.io, PDF, SVG

Related examples