How to call static method from another static method in JavaSript

1 Answer

0 votes
class StaticMethodsClass 
{
    static staticMethod1() 
    {
        return 'Static method 1';
    }
    static staticMethod2() 
    {
        return this.staticMethod1() + ' Static method 2';
    }
}
document.write(StaticMethodsClass.staticMethod1() + "<br />"); 
document.write(StaticMethodsClass.staticMethod2() + "<br />"); 

/*
run:

Static method 1
Static method 1 Static method 2 

*/

 



answered Aug 17, 2016 by avibootz

Related questions

1 answer 220 views
1 answer 166 views
1 answer 200 views
1 answer 160 views
1 answer 153 views
1 answer 182 views
...