function greetings() {
console.log("hello world");
greetings.counter++;
}
greetings.counter = 0;
greetings();
greetings();
console.log(`Called ${greetings.counter} times`); // Called 2 times
Thanks for reading 💙
Follow @codedrops.tech for daily posts.
Instagram ● Twitter ● Facebook
Micro-Learning ● Web Development ● Javascript ● MERN stack ● Javascript
codedrops.tech
Top comments (3)
Yfutf
Tory
Reach leave
Ropd
It's called static properties!