How to define and use static method in class with JavaScript

1 Answer

0 votes
<script type="text/JavaScript">   

class Worker {
  
  static staticMethod() {
    return 'I am static method'
  }
}

document.write(Worker.staticMethod());

/*
run:

I am static method 

*/

</script>

 



answered May 29, 2016 by avibootz

Related questions

1 answer 204 views
1 answer 189 views
1 answer 199 views
1 answer 213 views
1 answer 208 views
1 answer 186 views
...