<script>
class Example {
static staticVariable = 'code_breaker';
//static variable defined
static staticMethod() {
return 'staticVariable is : '+this.staticVariable;
}
}
// static method called
console.log(Example.staticMethod());
</script>
javascriptCopyfunction getId() {
if ( typeof getId.counter == 'undefined' ) {
getId.counter = 0;
}
alert(++getId.counter);
}