title: Get name of an Array or Object by Javascript
body: <p>I have a quite dummy but confusing question.
  How can we get the name of an exist array or object ?</p>
  <p>For example:</p>
  <pre><code>thisObject={ first:1, second:2};
  thisArray=[1,2,3,4]
  </code></pre>
  <p>I want to get the string &quot;thisObject&quot;, &quot;thisArray&quot;.</p>
  <p>How can we get it ?</p>
  <p>Thanks a lot.</p>
  <hr />
  <p>Edited:</p>
  <p>For more specific. I want to do something like this: <code>console.log(someFunction(thisObject))</code></p>
  <p>then it return</p>
  <p><code>&quot;thisObject&quot;</code></p>
  <hr />
  <p>Edited-2:</p>
  <pre><code>const firstArray=[1,2,3] 
  const secondArray=[&quot;a&quot;,&quot;b&quot;] 
  const render=(arr)=&gt;arr.map(arrr=&gt;console.log(Object.keys({arr})[0]))
  render(firstArray)
  render(secondArray)
  </code></pre>
  <p>it will return</p>
  <pre><code>&quot;arr&quot; &quot;arr&quot; 
  </code></pre>
  <p>Instead of</p>
  <pre><code>&quot;firstArray&quot; &quot;secondArray&quot;
  </code></pre>