Skip to content

Counter

JavaScript class method

Same task in: JavaTypeScript

Flowchart (ISO 5807)

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

Source code

JavaScript
class Counter {
    value = 0;
    inc() {
        this.value++;
    }
}

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

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

Related examples