localStorage理论上来说是永久有效的,即不主动清空的话就不会消失,即使保存的数据超出了浏览器所规定的大小,也不会把旧数据清空而只会报错。 但需要注意的是,在移动设备上的浏览器或各Native App用到的WebView里,localStorage都是不可靠的,可能会因为各种原因(比如说退出App、网络切换、内存不足等原因)被清空。sessionStorage的生存期顾名思义,类似于session,只要关闭浏览器(也包括浏览器的标签页),就会被清空。由于sessionStorage的生存期太短, 因此应用场景很有限,但从另一方面来看,不容易出现异常情况,比较可靠。- Git也允许手动建立追踪关系:git branch --set-upstream master origin/next
 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | {"lastUpload":"2017-07-17T09:31:16.435Z","extensionVersion":"v2.8.2"} | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | .selector{ | |
| overflow: hidden; | |
| text-overflow:ellipsis; | |
| white-space: nowrap;/*不换行*/ | |
| width: 50%; | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function Promise(fn) { | |
| var state = 'pending', | |
| value = null, | |
| callbacks = [] | |
| this.then = function(onFulfilled) { | |
| return new Promise(function(resolve) { | |
| //handle方法是当前 promise 的内部方法 | |
| handle({ | |
| onFulfilled: onFulfilled || null, //上一个promise的回调 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function commafy(num){ | |
| return num && num | |
| .toString()//匹配一个数字,条件是后面跟着三个数字一次或多次,且末尾"." | |
| .replace(/(\d)(?=(\d{3})+\.)/g, function($1, $2){ | |
| console.log($1,$2) | |
| return $1 + ','; | |
| }); | |
| } | |
| console.log(commafy(1234355645.1343)) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | git push origin --delete <branchName> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /** | |
| * Created by Li on 2017/3/26. | |
| */ | |
| function swap(array, i, j) { | |
| let temp | |
| temp = array[i] | |
| array[i] = array[j] | |
| array[j] = temp | |
| return array | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>Document</title> | |
| <style> | |
| .ani_dot { |