zoukankan      html  css  js  c++  java
  • 前端学习笔记

    1. npm命令

    设置代理,命令或修改配置文件。命令都是直接写入配置文件的。

    npm config set proxy http://proxynj.zte.com.cn

    npm config edit

    npm install semserver

    package

    a、"~1.2.3" 是神马意思呢,看下面领悟

    "~1.2.3" = ">=1.2.3 <1.3.0"

    "~1.2" = ">=1.2.0 <1.3.0"

    "~1" = ">=1.0.0 <1.1.0"

    b、"1.x.x"是什么意思呢,继续自行领悟

    "1.2.x" = ">=1.2.0 <1.3.0"

    "1.x.x" = ">=1.0.0 <2.0.0"

    "1.2" = "1.2.x"

    "1.x" = "1.x.x"

    "1" = "1.x.x"

     

    2. 箭头函数里的变量都是全局的,函数里闭包箭头函数和闭包普通函数不一样的。参考如下例子:

    2.1

    var tahoe = {
    resorts: ["Kirkwood","Squaw","Alpine","Heavenly","Northstar"],
    print: function(delay=1000) {
    setTimeout(() => {
    console.log(this === window)
    }, delay)
    }
    }
    tahoe.print() // false 

    2.2

    var tahoe = {
    resorts: ["Kirkwood","Squaw","Alpine","Heavenly","Northstar"],
    print: (delay=1000)=> {
    setTimeout(() => {
    console.log(this === window)
    }, delay)
    }
    }
    tahoe.print()  // true

     

    var tahoe = {
    resorts: ["Kirkwood","Squaw","Alpine","Heavenly","Northstar"],
    print: function(delay=1000) {
    setTimeout(function() {
    console.log(this.resorts.join(","))
    }, delay)
    }
    }
    tahoe.print() // Cannot read property 'join' of undefined 

     

    var tahoe = {
    resorts: ["Kirkwood","Squaw","Alpine","Heavenly","Northstar"],
    print: function(delay=1000) {
    setTimeout(() => {
    console.log(this.resorts.join(","))
    }, delay)
    }
    }
    tahoe.print() // Kirkwood, Squaw, Alpine, Heavenly, Northstar 

     

     

    var tahoe = {
    resorts: ["Kirkwood","Squaw","Alpine","Heavenly","Northstar"],
    print: (delay=1000) => {
    setTimeout(() => {
    console.log(this.resorts.join(","))
    }, delay)

    }
    tahoe.print() // Cannot read property resorts of undefined 

  • 相关阅读:
    系统调用简单总结
    系统调用原理详解
    总结:c 语言与Linux操作系统的关系
    poj3171 Cleaning Shifts
    洛谷P1032 字串变换
    poj3662 Telephone Lines
    洛谷P1073 最优贸易
    Uva1330/poj1964 City Game
    poj2559/SP1805 Largest Rectangle in a Histogram
    洛谷 P1196 [NOI2002]银河英雄传说
  • 原文地址:https://www.cnblogs.com/dusf/p/10005948.html
Copyright © 2011-2022 走看看