Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
rousan committed Jun 13, 2017
1 parent 459f206 commit 6a15d2a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 3 deletions.
4 changes: 4 additions & 0 deletions test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="symbol-es6.js"></script>
<script src="collections-es6.js"></script>
</head>
<body>

<script src="index.js"></script>

</body>
</html>
49 changes: 46 additions & 3 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
/**
* Created by ariyan on 6/13/17.
*/

var map = new Map([[1, 2], ["Hi", "Hello World"]]);

console.log(map.has(1)); //true
console.log(map.has("Hi")); //true

map.set(NaN, "NaN");
map.set(NaN, "Again NaN!");
map.set(0, "Zero");
map.set(-0, "Again Zero!");

console.log(map.size); //4
console.log(map.has(NaN)); //true
console.log(map.size); //4
console.log(map.has(0)); //true
console.log(map.has(-0)); //true

var set = new Set([NaN, 0, -0, "Hi", "Hello World"]);
set.add(Infinity);

console.log(set.has(NaN)); //true
console.log(set.has("Hi")); //true
console.log(set.size); //5
console.log(set.has(Infinity)); //true
console.log(set.has(-Infinity)); //false

var wm = new WeakMap();
wm.set(Object, "object");
wm.set(Function, "function");
wm.set({}, "new Object");

console.log(wm.has(Object)); //true
console.log(wm.has({})); //false

var ws = new WeakSet();
ws.add(Function);
ws.add({});

console.log(ws.has({})); //false
console.log(ws.has(Function)); //true

console.log(ES6.isMap(map)); //true
console.log(ES6.isSet(set)); //true
console.log(ES6.isWeakMap(wm)); //true
console.log(ES6.isWeakSet(ws)); //true

0 comments on commit 6a15d2a

Please sign in to comment.