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 210 views
1 answer 162 views
1 answer 197 views
1 answer 152 views
1 answer 146 views
1 answer 174 views
...