zoukankan      html  css  js  c++  java
  • JavaScript Succinctly 读后笔记

      1.JavaScript does not have block scope
      2.Scope is determined during function definintion,  not invocation -- Closoure
      3.Replacing the prototype property with new Object removes the default constructor property

      4. the default return value of new constructor is this.

    var Person = function(){
      this.name = "andy";
      // return this;
    }
    
    console.log(new Person().name); // output: andy
    

     5. some usful functions

    function existy(x) { return x != null };

     test case for existy -- JavaScript only has two values -- null and undefined that signify nonexistence

    existy(null);
    //=> false
    existy(undefined);
    //=> false
    existy({}.notHere);
    //=> false
    existy((function(){})());
    //=> false
    existy(0);
    //=> true
    existy(false);
    //=> true
    The use of existy
    

     =================

    function truthy(x) { return (x !== false) && existy(x) };
    

     test cases for truthy

    truthy(false);
    //=> false
    truthy(undefined);
    //=> false
    truthy(0);
    //=> true
    truthy('');
    //=> true
    
  • 相关阅读:
    开开心心
    HOW HE/SHE'S SEEN
    天池
    sql server deadlock跟踪的四种方法
    reduce 好东西
    object方法
    页面横向滚动 联动 进度条
    浅拷贝、深拷贝
    图片下载
    axios简单封装
  • 原文地址:https://www.cnblogs.com/buhaiqing/p/3208390.html
Copyright © 2011-2022 走看看