Interviewer: Can “x !== x” Return True in JavaScript?

<p>Recently I was asked a few strange interview questions. They are different from the regular questions: these interview questions seem very easy, but they test your thorough understanding of JavaScript. How many can you answer correctly?</p> <h1>1. Can &ldquo;x !== x&rdquo; return true?</h1> <p>What should be the value of &ldquo;x&rdquo; to output &ldquo;hello fatfish&rdquo;?</p> <p><iframe frameborder="0" height="127" scrolling="no" src="https://javascript.plainenglish.io/media/b5b2279853b0a6b00e0ada8883c3d326" title="q1.js" width="680"></iframe></p> <p><strong>It&rsquo;s amazing. Is there any value that is not equal to itself?</strong>&nbsp;However, there is a value&nbsp;<code>NaN</code>&nbsp;in JavaScript, which is not equal to any value or even itself.</p> <p><iframe frameborder="0" height="193" scrolling="no" src="https://javascript.plainenglish.io/media/cbcccc9b171e8dbe0230514e9e20216c" title="q-1.js" width="680"></iframe></p> <p><img alt="" src="https://miro.medium.com/v2/resize:fit:425/0*ZguvjqaPAeBh11Pw.png" style="height:207px; width:472px" /></p> <h1>2. Can (!isNaN(x) &amp;&amp; x !== x) return true?</h1> <p>Okay, when we filter out &ldquo;NaN&rdquo;, what other value can make a value not equal to itself?</p> <p><iframe frameborder="0" height="127" scrolling="no" src="https://javascript.plainenglish.io/media/61bb20b1dba48623ca77806dd142cfd4" title="q2-1.js" width="680"></iframe></p> <p>Maybe you know &ldquo;object. Defineproperty&rdquo;, which can help us solve this problem.</p> <p><a href="https://javascript.plainenglish.io/interviewer-can-x-x-return-true-in-javascript-20ca50ced0ca">Click Here</a></p>