Skip to content

Commit 13be54e

Browse files
authored
Create 9.2StaticFunctionAndNormalFunction.js
1 parent 5bb1744 commit 13be54e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class config{
2+
static a1={
3+
1:'hello'
4+
};
5+
//using this keyword for accessing a static property inside a static method
6+
static show(){
7+
console.log('static show');
8+
console.log(this.a1);
9+
}
10+
//accessing a static function inside a normal fuction
11+
display(){
12+
console.log('display show 1');
13+
config.show();
14+
}
15+
}
16+
config.show(); //calling static fx
17+
const a=new config(); //calling normal function
18+
a.display();

0 commit comments

Comments
 (0)