title: Javascript - Simplest and effective way to check null or undefined for objects and arrays
body: <p>I'm been seeing a lot of articles and even with the <code>underscore</code> or <code>lodash</code> libraries, different ways to evaluate if some variable/const is <code>null</code> or <code>undefined</code> (as the <code>isNil</code> method)... but JS has some way to evaluate that, but, not commonly suggested...</p>
  <p>So, I want to know if this code works? or if could break something in my app in some scenario:</p>
  <pre><code>let timesCorrect = 0;
  let myVal = null;
  
  if(!myVal) timesCorrect++;
  
  myVal = undefined;
  if(!myVal) timesCorrect++;
  
  console.log(`Times that the validation is correct ${timesCorrect}`)
  
  myVal = []
  if(!myVal) console.warn('ERROR!') // NOT HAPPENS
  if(myVal) console.log('Has an empty array or something different to null/undefined')
  if(!!myVal) console.log('Has an empty array or something different to null/undefined [Double negation]')
  
  myVal = {}
  if(!myVal) console.warn('ERROR!') // NOT HAPPENS
  if(myVal) console.log('Has an empty object or something different to null/undefined')
  if(!!myVal) console.log('Has an empty object or something different to null/undefined [Double negation]')
  
  </code></pre>
  <p>I know that instead to use <code>===</code> we can use <code>==</code> to validate if a value is null or undefined... but, the <code>lint</code> rules throw me a warning, and I want to still on this validation.</p>
  <p>And I know that could be tricky if we don't know the data type of the variable/const... but, if I know that I expect an object or an array, this validation makes sense for me.</p>