Static Method Example

Define a static method on a class.

Preview

Code

<script>
class MathHelper {
  static add(a, b){
    return a + b;
  }
}

console.log(MathHelper.add(5,3));
</script>

More JS Classes Examples (7)