use! To determine whether data is present

In operation often encountered with ! Determines whether the data exists in the case of, for example: if (! A) {balabala } simply summarize, imperfect later added:

First, based on the type of

  let a = '';

  let a = null;

  let a = undefined;

  let a = false;

  let a = 0;

Second, the type can not be determined

  let a = [];

  let a = {};

  let a = 1;

Third, the determination method

  console.log(!a);

 

Guess you like

Origin www.cnblogs.com/zhangruiqi/p/11611300.html