Quick actions

cmd+k|ctrl+k

Navigation

Languages

Clovek

Snippet info

Language

JavaScript

Visibility

public

Author

jsonkody

Created

2019-12-18T14:40:51Z

Updated

2019-12-18T14:40:51Z

class Clovek {
    
    static getCounter() {
        return Clovek.people_count
    }
    
    constructor(name, age) {
        this.name = name
        this.age = age
        Clovek.people_count++
    }
    
    whoami() {
        console.log(`Hello, I am ${this.name}. I am ${this.age} years old.`)
    }
}
Clovek.people_count = 0


const dan = new Clovek("Daniel", 31)
dan.whoami()

const simon = new Clovek("Simon", "?")
simon.whoami()

console.log(`People count: ${Clovek.getCounter()}`)
INFO