JavaScript Get object name in jquery? get object name jquery,object class name jquery,json object

I have two classes in jquery e.g:

function a(){

this.init = function(a){}

}

function b(){

this.init = function(a){}

}

Both the classes have this.init() method.I have a situation that i have the object of both classes and i want to call init() method of class b how can i know the name of the custom object so that i can easily call the init() method of class b like

if (current_object == typeof b)
  current_object.init()
Answer:1

Use instanceof,

if (current_object instanceof b)
  current_object.init()
Answer:2

I have a problem with JavaScript callback functions. I'm using node Js and node-mysql to process mysql queries. When new users registered i need to do 2 db checks if This email already registered and ...

I have a problem with JavaScript callback functions. I'm using node Js and node-mysql to process mysql queries. When new users registered i need to do 2 db checks if This email already registered and ...

  1. javascript process function

According to this link by mozilla, the data- attribute is used for setting data in the DOM. I want to grab the time using new Date().getTime() and append it to an element in the DOM. What is the ...

According to this link by mozilla, the data- attribute is used for setting data in the DOM. I want to grab the time using new Date().getTime() and append it to an element in the DOM. What is the ...

This site is probably overkill for the level of technical input I need for my query but the only other option is to ask Weebly support who are useless. Essentially I have a tracking pixel from google ...

This site is probably overkill for the level of technical input I need for my query but the only other option is to ask Weebly support who are useless. Essentially I have a tracking pixel from google ...

  1. adding tracking pixel to email
  2. adding tracking pixel to html
  3. adding a tracking pixel to website
  4. shopify adding a tracking pixel

I am working with dynamic web, this connected to websocket, then when my web load, i call a load.php (with angular directive). This web(load.php) makes a select in mySQL (i have many tables, linked ...

I am working with dynamic web, this connected to websocket, then when my web load, i call a load.php (with angular directive). This web(load.php) makes a select in mySQL (i have many tables, linked ...