Skip to content

Instantly share code, notes, and snippets.

@sorie
Created January 3, 2019 02:55
Show Gist options
  • Save sorie/5e8281f9bb2620ed480ddd166ca901a6 to your computer and use it in GitHub Desktop.
Save sorie/5e8281f9bb2620ed480ddd166ca901a6 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/zawobon
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div>The usefulness of nonsensical content
Dummy text is also used to demonstrate the appearance of different typefaces and layouts, and in general the content of dummy text is nonsensical. Due to its widespread use as filler text for layouts, non-readability is of great importance: human perception is tuned to recognize certain patterns and repetitions in texts. If the distribution of letters and 'words' is random, the reader will not be distracted from making a neutral judgement on the visual impact and readability of the typefaces (typography), or the distribution of text on the page (layout or type area). For this reason, dummy text usually consists of a more or less random series of words or syllables. This prevents repetitive patterns from impairing the overall visual impression and facilitates the comparison of different typefaces. Furthermore, it is advantageous when the dummy text is relatively realistic so that the layout impression of the final publication is not compromised.</div>
<script id="jsbin-javascript">
//************
//set&WeakSet
//************
document.querySelector("div").addEventListener("click",function({type,target}){
console.log(type);
});
let mySet = new Set();
// console.log(toString.call(mySet));
//set: 중복없이 유일한 갑을 저장하려고 할때, 이미 존재하는지 체크
mySet.add("crong");
mySet.add("hary");
mySet.add("crong");
console.log(mySet.has("crong"));
mySet.delete("crong");
mySet.forEach(function(v){
console.log(v);
})
//weakset
//참조를 가지고 있는 객체만 저장이 가능하다.
//객체형태를 중복없이 저장하려고 할때 유용하다.
let arr = [1,2,3,4];
let arr2 = [5,6,7,8];
let obj = {arr,arr2};
let ws = new WeakSet();
ws.add(arr);
ws.add(arr2);
ws.add(obj);
console.log(ws);
console.log(ws.has(arr));
</script>
<script id="jsbin-source-javascript" type="text/javascript">//************
//set&WeakSet
//************
document.querySelector("div").addEventListener("click",function({type,target}){
console.log(type);
});
let mySet = new Set();
// console.log(toString.call(mySet));
//set: 중복없이 유일한 갑을 저장하려고 할때, 이미 존재하는지 체크
mySet.add("crong");
mySet.add("hary");
mySet.add("crong");
console.log(mySet.has("crong"));
mySet.delete("crong");
mySet.forEach(function(v){
console.log(v);
})
//weakset
//참조를 가지고 있는 객체만 저장이 가능하다.
//객체형태를 중복없이 저장하려고 할때 유용하다.
let arr = [1,2,3,4];
let arr2 = [5,6,7,8];
let obj = {arr,arr2};
let ws = new WeakSet();
ws.add(arr);
ws.add(arr2);
ws.add(obj);
console.log(ws);
console.log(ws.has(arr));
</script></body>
</html>
//************
//set&WeakSet
//************
document.querySelector("div").addEventListener("click",function({type,target}){
console.log(type);
});
let mySet = new Set();
// console.log(toString.call(mySet));
//set: 중복없이 유일한 갑을 저장하려고 할때, 이미 존재하는지 체크
mySet.add("crong");
mySet.add("hary");
mySet.add("crong");
console.log(mySet.has("crong"));
mySet.delete("crong");
mySet.forEach(function(v){
console.log(v);
})
//weakset
//참조를 가지고 있는 객체만 저장이 가능하다.
//객체형태를 중복없이 저장하려고 할때 유용하다.
let arr = [1,2,3,4];
let arr2 = [5,6,7,8];
let obj = {arr,arr2};
let ws = new WeakSet();
ws.add(arr);
ws.add(arr2);
ws.add(obj);
console.log(ws);
console.log(ws.has(arr));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment