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!