Back to Blog
Js get class name6/21/2023 Description A constructor enables you to provide any custom initialization that must be done before any other methods can be called on an instantiated object. A class cannot have more than one constructor method. className property returns the classes in class attribute separated by space, in a String. A class method called constructor cannot be a getter, setter, async, or generator. You can loop through these classes and get/check for the one you required. attr('class') will give you all the classes associated to that element. Return obj.toString().match(/ (\w )/) Ĭonsole.log("constructor:", what(p.constructor), "name:", p.constructor.name, "class:", what(p)) įunction Player() else if (type = 'function'
0 Comments
Read More
Leave a Reply. |