{"action":"created","issue":{"url":"https://api.github.com/repos/zuppachu/Joanne-s-Learning-Blog/issues/10","repository_url":"https://api.github.com/repos/zuppachu/Joanne-s-Learning-Blog","labels_url":"https://api.github.com/repos/zuppachu/Joanne-s-Learning-Blog/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/zuppachu/Joanne-s-Learning-Blog/issues/10/comments","events_url":"https://api.github.com/repos/zuppachu/Joanne-s-Learning-Blog/issues/10/events","html_url":"https://github.com/zuppachu/Joanne-s-Learning-Blog/issues/10","id":368074200,"node_id":"MDU6SXNzdWUzNjgwNzQyMDA=","number":10,"title":"[ YDKJS ] - 節錄筆記","user":{"login":"zuppachu","id":36746692,"node_id":"MDQ6VXNlcjM2NzQ2Njky","avatar_url":"https://avatars3.githubusercontent.com/u/36746692?v=4","gravatar_id":"","url":"https://api.github.com/users/zuppachu","html_url":"https://github.com/zuppachu","followers_url":"https://api.github.com/users/zuppachu/followers","following_url":"https://api.github.com/users/zuppachu/following{/other_user}","gists_url":"https://api.github.com/users/zuppachu/gists{/gist_id}","starred_url":"https://api.github.com/users/zuppachu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zuppachu/subscriptions","organizations_url":"https://api.github.com/users/zuppachu/orgs","repos_url":"https://api.github.com/users/zuppachu/repos","events_url":"https://api.github.com/users/zuppachu/events{/privacy}","received_events_url":"https://api.github.com/users/zuppachu/received_events","type":"User","site_admin":false},"labels":[{"id":1051481627,"node_id":"MDU6TGFiZWwxMDUxNDgxNjI3","url":"https://api.github.com/repos/zuppachu/Joanne-s-Learning-Blog/labels/note","name":"note","color":"8aeaca","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-09T07:25:53Z","updated_at":"2018-10-09T21:02:00Z","closed_at":null,"author_association":"OWNER","body":"From JayKeyGuo - YDKJS 中譯版\r\n\r\n# 你不懂JS：入門與進階\r\n\r\n> Ch 1\r\n## loops\r\n\r\n一个循环包含测试条件和一个块儿（通常是`{ .. }`）。每次循环块儿执行，都称为一次 *迭代*。\r\n\r\nwhile循环 和 do..while循环 说明 ： 重复一块儿语句（block）直到一个条件不再求值得true：\r\n\r\n```js\r\nwhile (numOfCustomers > 0) {\r\n\tconsole.log( \"How may I help you?\" );\r\n\r\n\t// 服务顾客……\r\n\r\n\tnumOfCustomers = numOfCustomers - 1;\r\n}\r\n\r\n// 与\r\n\r\ndo {\r\n\tconsole.log( \"How may I help you?\" );\r\n\r\n\t// 服务顾客……\r\n\r\n\tnumOfCustomers = numOfCustomers - 1;\r\n} while (numOfCustomers > 0);\r\n```\r\n这些循环之间唯一的实际区别是：\r\n条件是在第一次迭代之前（while）还是之后（do..while）被测试。\r\n\r\n\r\n## 作用域\r\n\r\n在同一个作用域内变量名(var X)必须是唯一的！ 不能有两个不同的变量a并排出现。\r\n但是相同的变量名a可以出现在不同的作用域中。\r\n```js\r\nfunction one() {\r\n\t// 这个 `a` 仅属于函数 `one()`\r\n\tvar a = 1;\r\n\tconsole.log( a );\r\n}\r\n\r\nfunction two() {\r\n\t// 这个 `a` 仅属于函数 `two()`\r\n\tvar a = 2;\r\n\tconsole.log( a );\r\n}\r\n\r\none();\t\t// 1\r\ntwo();\t\t// 2\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/zuppachu/Joanne-s-Learning-Blog/issues/comments/428350807","html_url":"https://github.com/zuppachu/Joanne-s-Learning-Blog/issues/10#issuecomment-428350807","issue_url":"https://api.github.com/repos/zuppachu/Joanne-s-Learning-Blog/issues/10","id":428350807,"node_id":"MDEyOklzc3VlQ29tbWVudDQyODM1MDgwNw==","user":{"login":"zuppachu","id":36746692,"node_id":"MDQ6VXNlcjM2NzQ2Njky","avatar_url":"https://avatars3.githubusercontent.com/u/36746692?v=4","gravatar_id":"","url":"https://api.github.com/users/zuppachu","html_url":"https://github.com/zuppachu","followers_url":"https://api.github.com/users/zuppachu/followers","following_url":"https://api.github.com/users/zuppachu/following{/other_user}","gists_url":"https://api.github.com/users/zuppachu/gists{/gist_id}","starred_url":"https://api.github.com/users/zuppachu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zuppachu/subscriptions","organizations_url":"https://api.github.com/users/zuppachu/orgs","repos_url":"https://api.github.com/users/zuppachu/repos","events_url":"https://api.github.com/users/zuppachu/events{/privacy}","received_events_url":"https://api.github.com/users/zuppachu/received_events","type":"User","site_admin":false},"created_at":"2018-10-09T21:02:00Z","updated_at":"2018-10-09T21:02:00Z","author_association":"OWNER","body":"# 你不懂JS：入門與進階\r\n\r\n> Ch 2 进入JavaScript\r\n\r\n在JavaScript中只有「值」拥有类型；变量只是这些值的简单容器。\r\n\r\n\r\n简单规则帮助判断是否使用`==`或`===`：\r\n\r\n- 如果一个比较的两个值之一可能是true或false值，避免`==`而使用`===`。\r\n- 如果一个比较的两个值之一可能是这些具体的值（0，\"\"，或[] —— 空数组），避免`==`而使用`===`。\r\n- 在 所有 其他情况下，你使用==是安全的。它不仅安全，而且在许多情况下它可以简化你的代码并改善可读性。\r\n\r\n```js\r\nvar a = [1,2,3];\r\nvar b = [1,2,3];\r\nvar c = \"1,2,3\";\r\n\r\na == c;\t\t// true\r\nb == c;\t\t// true\r\na == b;\t\t// false => 我的解讀是因為 陣列 儲存記憶體位置不同。\r\n```\r\n\r\n## 閉包\r\n：即便函数已经完成了运行，它依然可以“记住”并持续访问函数的作用域。\r\n\r\n完全沒看懂範例，需再看幾遍！\r\n\r\n## this 标识符\r\n\r\n如果一个函数在它内部拥有一个this引用，那么这个this引用通常指向一个object。但是指向哪一个object要看这个函数是如何被调用的。重要的是要理解this 不是 指函数本身，这是最常见的误解。\r\n\r\n## 原型\r\n\r\n当你引用一个对象上的属性时，如果这个属性不存在，JavaScript将会自动地使用这个对象的内部原型引用来寻找另外一个对象，在它上面查询你想要的属性。你可以认为它几乎是在属性缺失时的备用对象。\r\n\r\n从一个对象到它备用对象的内部原型引用链接发生在这个对象被创建的时候。说明它的最简单的方法是使用称为Object.create(..)的内建工具。\r\n\r\n```js\r\nvar foo = {\r\n\ta: 42\r\n};\r\n\r\n// 创建 `bar` 并将它链接到 `foo`\r\nvar bar = Object.create( foo );\r\n\r\nbar.b = \"hello world\";\r\n\r\nbar.b;\t\t// \"hello world\"\r\nbar.a;\t\t// 42 <-- 委托到 `foo`\r\n```\r\n\r\n\r\n值，类型，函数闭包，this，和原型。"}}
{"actor":{"display_login":"zuppachu"}}