How to achieve static variable in javascript