title: How get the object name that the running function belongs to?
body: <p>I'm trying to write a db abstraction in node js and here is the situation :</p>
  
  <p>Imagine I have a tables array of objects which has an object for each table in the database :</p>
  
  <pre><code>tables = [{ tableName: product, select: mySelect  }, { tableName: order, select: mySelect  }]
  </code></pre>
  
  <p>and as you can see each table has a select. Now the problem is that in mySelect function I would like to generate a sql script based on caller's table name as follows :</p>
  
  <pre><code>function mySelect(){
    var tableName = //Find the callers name (for instance product);
    var select = "SELECT * FROM " + tableName
  }
  </code></pre>
  
  <p>how can I get the name of the object which is calling the select function in JavaScript? </p>