创建: 2019/02/20

迁入: 删除【WIP】标签(因为随时更新, 不存在完成不完成)

    从【JavaScript 式与运算符】迁入typeof

更新: 2019/03/25 补充静态变量与参照变量

更新: 2019/06/06 增加==便于找到false判断, 增加false也是

parseInt, parseFloat, isNaN, Object.getPrototypeOf,

 静态变量与参照变量
 静态变量 数值,字符串, true/false, undefined/null, Symbol
 参照变量 除了静态变量外的一切量
 类相关
 判断类型
 typeof
 返回对象值数据类型,字符串

typeof "A" //string
 数据 返回值 
 数字和NaN "number"
 字符串 "string"
 未定义值
 (就一个undefined)
 "undefined"
 空值null "object"
 符号
 Symbol("sample")
 "symbol"
 函数以外的对象 "object"
 函数 "function"
  
  
 instanceof

a instanceof A // 对象 instanceof 构造函数

function F() {};
var obj = new F();
console.log(obj instanceof F); // true
console.log(obj instanceof Object); // true
console.log(obj instanceof Date); // false
 prototype.isPrototypeOf()

prototype.isPrototypeOf(对象);

function F() {};
var obj = new F();
console.log(F.prototype.isPrototypeOf(obj)); // true
console.log(Object.prototype.isPrototypeOf(obj)); // true
console.log(Date.prototype.isPrototypeOf(obj)); // false
 属性相关

判断指定属性是否存在

 in

注: 包括继承的(__proto__的)

  var a = { a: 1 };
var b = Object.create(a, {
b: {
value: 1,
writbale: true,
enumerable: true,
configurable: true
}
});
console.log(b);
console.log('------------------in--------------------');
console.log('b' in b); // true
console.log('a' in b); // true
console.log('--------------hasOwnProperty---------------');
console.log(b.hasOwnProperty('b')); // true
console.log(b.hasOwnProperty('a')); // false
 Object.prototype.hasOwnProperty(key)

注: 仅验证当前类(当前的prototype)

  var a = { a: 1 };
var b = Object.create(a, {
b: {
value: 1,
writbale: true,
enumerable: true,
configurable: true
}
});
console.log(b);
console.log('------------------in--------------------');
console.log('b' in b); // true
console.log('a' in b); // true
console.log('--------------hasOwnProperty---------------');
console.log(b.hasOwnProperty('b')); // true
console.log(b.hasOwnProperty('a')); // false
 Object.is(value1, value2) 判断value1和value2是否相同
 Object.isExtensible(obj) 判断是否可以扩展
 Object.isFrozen(obj) 判断是否被冻结
 Object.isSealed(obj) 判断是否受保护 
 运算符
 与运算符

a && b

若a可转换为true,则返回b;否则,返回a

 或运算符
a || b

若a可转换为true, 返回a; 否则返回b

 非运算符

!a

若a可转换为true, 返回false; 否则返回true

  
  
 会被转换为false的表达式

==

● null

● NaN

● 0

● "", '', ``

● undefined

● false

  
  
05-28 23:11