title: How to import util module in Node.js?
body: <p>isDeepStrictEqual() method to do object comparison but am blocked by error:</p>
  <pre><code>util.isDeepStrictEqual() is not a function
  </code></pre>
  <ol>
  <li><p>According to official documentation: this method was introduced in v9.0.0 and I am using Node v12: <a href="https://nodejs.org/api/util.html#util_util_isdeepstrictequal_val1_val2" rel="nofollow noreferrer">https://nodejs.org/api/util.html#util_util_isdeepstrictequal_val1_val2</a></p>
  </li>
  <li><p>I confirmed this method is available on command line:</p>
  <pre><code>D:\&gt;node
  Welcome to Node.js v12.18.2.
  Type &quot;.help&quot; for more information.
  &gt; require(&quot;util&quot;).isDeepStrictEqual({'name': 'john'}, {'sex': 'male'})
  false
  &gt; require(&quot;util&quot;).isDeepStrictEqual({'sex': 'john'}, {'sex': 'male'})
  false
  &gt; require(&quot;util&quot;).isDeepStrictEqual({'sex': 'male'}, {'sex': 'male'})
  true
  </code></pre>
  </li>
  <li><p>Here is my code:</p>
  <pre><code>class App extends Component {
  
   constructor(props) {
       super(props);
       var util = require('util');
       var obj1 = {name: 'john'};
       var obj2 = {sex: 'male'};
       var result = util.isDeepStrictEqual(obj1, obj2);
   }
  </code></pre>
  </li>
  </ol>