表达式、运算符

表达式

  • 原始表达式
  • 字面量初始化
  • 函数定义表达式
  • 访问属性表达式
  • 创建对象表达式
  • 错误机制 try | catch | finally

运算符

熟悉的运算符如果有深入不理解的,可以查询Reference Book

  • delete 不能够删除var所声明的变量,delete 一般用于删除对象的属性值
  • typeof 返回原始对象的类型
  1. typeof new String('5'); // object
  2. typeof new RegExp('/u+'); // object
  3. typeof NaN // number
  4. typeof Null // object
  5. typeof Undefined // undefined
  • void 返回 undefined
  • instanceof
  • =====

    • type coercion
    • 为了避免隐式转换所带来的晦涩难懂,尽可能不使用 ===
  • new
function trivialNew(constructor, ...args) {
  var o = {}; // Create an object
  constructor.apply(o, args);
  return o;
}