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 “x !== x” return true?</h1>
<p>What should be the value of “x” to output “hello fatfish”?</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’s amazing. Is there any value that is not equal to itself?</strong> However, there is a value <code>NaN</code> 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) && x !== x) return true?</h1>
<p>Okay, when we filter out “NaN”, 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 “object. Defineproperty”, 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>