Friday, 22 March 2019

Javascript static members







I have a problem with javascript. What I intend to do is to simulate a class named Tooltip. Ex:



var Tooltip = function(){

this.draw = .....;
/////////// other members and methods

this.Static = ...; // this one I want to be static }


The problem is I can't find a method to declare a static method/member. And I presume that the above way doesn't work.
Is there any method to simulate a class with a static member? (preferably using object literals)



LE: I forgot to tell that I want to have acces to the static members from an instance of the class.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print ...