se、map、 proxy、symbol總結
是es6中新增的乙個資料結構。可以理解為乙個內容不可重複的陣列 + 初始化
常用方法和屬性
add(item)用於向set物件內新增一項
item 被新增的項
注: 如果新增的是已經存在的內容 則新增失敗
var set = new set([0, 1, 2, 3, {}]);
set.add(6); // 新增成功
set.add(-0); // 新增失敗
delete(item)用於刪除一項
被刪除的項
注: 如果是引用型別 則必須位址一致才會刪除成功
set.delete(1);
clear()清空
set.clear();
has(item)判定是否存在
set.has(1); // true | false
foreach(fun)迴圈、迭代方法
fun(value, index,self) 函式 函式有三個引數
value 成員
index索引
self set物件本身
var set= new set();
map.foreach(function(value, index, self) );
for of:es6中新增的專門用於迴圈迭代器的語法
for (var i of set)
map可以理解為乙個超級物件
普通的物件: key必須是字串
map物件: key可以是任意的資料型別
初始化:
var map = new map();
常用方法和屬性
set(key, value) 設定
key 儲存的鍵名
value 儲存的值
var map = new map();
map.set("a", "a");
map.set(1, 1);
map.set(undefined, undefined);
map.set(false, false);
map.set(null, null);
map.set({}, {});
map.set(, );
map.set(function() {}, function() {});
get(key)根據key獲取value
返回值 鍵值
var map = new map();
map.set(1, 1);
map.get(1); // 1
delete(key)根據key刪除屬性
var map = new map();
map.delete(1);
has(key)根據key判定是否存在鍵值對
返回值 布林值 true表示存在 false表示不存在
var map = new map();
map.has(1); // false
foreach(fun)迴圈、迭代方法
fun(value, index,self) 函式 函式有三個引數
value 成員
index索引
self map物件本身
var map = new map();
map.foreach(function(value, index, self) );
for of:迴圈map成員
for (var i of map)
**是es6中新增的建構函式但是它的特點是例項自身沒有任何屬性和方法。
proxy是乙個**建構函式。
symbol是es6中新增的種資料型別
js中的資料型別:現在有七種 string、 number、 boolean、 null、undefined、 symbol、 object
symbol是一種符號型別表示獨一無二
var s = symbol();
console.log(typeof s); // symbol
console.log(typeof ""); // string
console.log(typeof 1); // number
console.log(typeof null); // object 乙個公認的bug
console.log(typeof undefined); // undefined
console.log(typeof true); // boolean
console.log(typeof ); // object
console.log(typeof {}); // object
console.log(typeof function() {}); // function
console.log(typeof new date()); // object
console.log(typeof new regexp()); // object
Android tensorflow 基礎知識學習
今天記錄下tensorflow的一些基本知識 1.匯入tensorflow 庫,且指令碼中新增執行使用的python環境 user bin env python import tensorflow as tf 匯入tensorflow庫 匯入 mnist 資料集 資料在linux 根目錄 data下...
Hyperledger Fabric 基礎知識筆記
區塊鏈可以幫助在競爭者之間或具有相反商業利益的組織之間建立信任,這可能導致爭執。資產在hyperledger fabric中表示為鍵值對的集合,狀態更改記錄為通道 分類賬中的事務。資產可以二進位制和 或json形式表示。chaincode是定義一項或多項資產的軟體,以及用於修改資產的交易指令 換句話...
Hyperledger Fabric基礎知識摘記
fabric是hyperledger專案的乙個子專案,它實現了區塊鏈技術,是一種基於交易呼叫和數字事件的分布式共享賬本技術。它採用模組化的架構設計,支援可插拔的元件開發和使用。fabric引入了成員管理的服務,即每個參與者都需要得到對應的證書證明身份才能夠訪問fabric系統,同時引入了多通道的概念...