Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

static variable in javascript

<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>
 
PREVIOUS NEXT
Tagged: #static #variable #javascript
ADD COMMENT
Topic
Name
3+1 =