{"id":1652,"date":"2017-07-17T16:41:20","date_gmt":"2017-07-17T08:41:20","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=1652"},"modified":"2017-07-17T16:41:20","modified_gmt":"2017-07-17T08:41:20","slug":"symbol-%e5%b1%9e%e6%80%a7%e6%b1%87%e6%80%bb","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=1652","title":{"rendered":"Symbol \u5c5e\u6027\u6c47\u603b"},"content":{"rendered":"<p>\n\tES6 \u5f15\u5165\u4e86\u4e00\u4e9b\u5f88\u5b9e\u7528\u5f88\u5f3a\u5927\u7684\u7279\u6027\u548c\u4e00\u4e9b\u8bed\u6cd5\u3002\u4eca\u5929\u8bf4\u7684 Symbol \u5c31\u662f\u5176\u4e2d\u4e00\u4e2a\u3002<br \/>\n\t\u5bf9\u4e8e\u8fd9\u4e2a\u65b0\u7279\u6027\uff0c\u5f88\u591a\u4eba\u4f30\u8ba1\u5f88\u5c11\u4f7f\u7528\u5b83\uff0c\u5c24\u5176\u662f\u53ef\u89c1\u6027\u5c01\u88c5\u7279\u522b\u597d\u7684\u65f6\u5019\u3002\u4f46\u5b83\u4e5f\u6709\u5f88\u5e94\u7528\u573a\u666f\u7684\u3002<br \/>\n\tSymbol \u7684\u8bed\u6cd5\u5f88\u7b80\u5355\uff0c\u5c5e\u6027\u5374\u6709\u5f88\u591a\u3002\u672c\u6587\u603b\u7ed3\u4e86Symbol \u7684\u4f17\u591a\u5c5e\u6027\uff0c\u65b9\u4fbf\u5927\u5bb6\u53c2\u8003\u3002\n<\/p>\n<h2>\n\tSymbol \u6570\u636e\u7c7b\u578b<br \/>\n<\/h2>\n<p>\n\t\u9996\u5148\u5b83\u662f ES6 \u5f15\u5165\u7684\u4e00\u4e2a js \u6570\u636e\u7c7b\u578b\u3002\u719f\u6089 JavaScript \u7684\u90fd\u77e5\u9053\uff0cjavascript \u6709\u4e03\u5927\u6570\u636e\u7c7b\u578b\u3002\n<\/p>\n<pre class=\"brush:jscript;\">\r\nnull, undefined, number, boolean, string, Array\u3001object  \r\n\/\/ \u57fa\u672c\u6570\u636e\u7c7b\u578b\uff1anull\u3001undefined\u3001\u6570\u5b57\u3001\u5e03\u5c14\u3001\u5b57\u7b26\u4e32  \r\n\/\/ \u590d\u6742\u6570\u636e\u7c7b\u578b: \u6570\u7ec4\u3001\u5bf9\u8c61\u7b49  <\/pre>\n<h2>\n\tSymbol \u5c5e\u6027<br \/>\n<\/h2>\n<ul>\n<li>\n\t\tSymbol.length\uff1a\u957f\u5ea6\u5c5e\u6027\u503c\u4e3a1\u3002\n\t<\/li>\n<li>\n\t\tSymbol.name \uff1a\u4ec5Chrome\/v8\u3002\u8fd4\u56de\u7b26\u53f7\u63cf\u8ff0\u3002\n\t<\/li>\n<li>\n\t\tSymbol.prototype\uff1a\u63cf\u8ff0\u7b26\u53f7\u6784\u9020\u51fd\u6570\u7684\u539f\u578b\u3002\n\t<\/li>\n<li>\n\t\tSymbol.iterator\uff1a\u8fed\u4ee3 symbols\u3002\u4e00\u4e2a\u8fd4\u56de\u4e00\u4e2a\u5bf9\u8c61\u9ed8\u8ba4\u8fed\u4ee3\u5668\u7684\u65b9\u6cd5\u3002\u4f7f\u7528 for&#8230;of\u3002\n\t<\/li>\n<li>\n\t\tSymbol.match\uff1a\u6b63\u5219\u8868\u8fbe\u5f0f symbols\u3002\u4e00\u4e2a\u7528\u4e8e\u5bf9\u5b57\u7b26\u4e32\u8fdb\u884c\u5339\u914d\u7684\u65b9\u6cd5\uff0c\u4e5f\u7528\u4e8e\u786e\u5b9a\u4e00\u4e2a\u5bf9\u8c61\u662f\u5426\u53ef\u4ee5\u4f5c\u4e3a\u6b63\u5219\u8868\u8fbe\u5f0f\u4f7f\u7528\u3002\u4f7f\u7528 String.prototype.match()\u3002\n\t<\/li>\n<li>\n\t\tSymbol.replace\uff1a\u4e00\u4e2a\u66ff\u6362\u5339\u914d\u5b57\u7b26\u4e32\u7684\u5b50\u4e32\u7684\u65b9\u6cd5. \u4f7f\u7528 String.prototype.replace()\u3002\n\t<\/li>\n<li>\n\t\tSymbol.search\uff1a\u4e00\u4e2a\u8fd4\u56de\u4e00\u4e2a\u5b57\u7b26\u4e32\u4e2d\u4e0e\u6b63\u5219\u8868\u8fbe\u5f0f\u76f8\u5339\u914d\u7684\u7d22\u5f15\u7684\u65b9\u6cd5\u3002\u4f7f\u7528String.prototype.search()\u3002\n\t<\/li>\n<li>\n\t\tSymbol.split\uff1a\u4e00\u4e2a\u5728\u5339\u914d\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u7d22\u5f15\u5904\u62c6\u5206\u4e00\u4e2a\u5b57\u7b26\u4e32\u7684\u65b9\u6cd5.\u3002\u4f7f\u7528 String.prototype.split()\u3002\n\t<\/li>\n<li>\n\t\tSymbol.hasInstance\uff1a\u4e00\u4e2a\u786e\u5b9a\u4e00\u4e2a\u6784\u9020\u5668\u5bf9\u8c61\u8bc6\u522b\u7684\u5bf9\u8c61\u662f\u5426\u4e3a\u5b83\u7684\u5b9e\u4f8b\u7684\u65b9\u6cd5\u3002\u4f7f\u7528 instanceof\u3002\n\t<\/li>\n<li>\n\t\tSymbol.isConcatSpreadable\uff1a\u4e00\u4e2a\u5e03\u5c14\u503c\uff0c\u8868\u660e\u4e00\u4e2a\u5bf9\u8c61\u662f\u5426\u5e94\u8be5flattened\u4e3a\u5b83\u7684\u6570\u7ec4\u5143\u7d20\u3002\u4f7f\u7528Array.prototype.concat()\u3002\n\t<\/li>\n<li>\n\t\tSymbol.unscopables\uff1a\u62e5\u6709\u548c\u7ee7\u627f\u5c5e\u6027\u540d\u7684\u4e00\u4e2a\u5bf9\u8c61\u7684\u503c\u88ab\u6392\u9664\u5728\u4e0e\u73af\u5883\u7ed1\u5b9a\u7684\u76f8\u5173\u5bf9\u8c61\u5916\u3002\n\t<\/li>\n<li>\n\t\tSymbol.species\uff1a\u4e00\u4e2a\u7528\u4e8e\u521b\u5efa\u6d3e\u751f\u5bf9\u8c61\u7684\u6784\u9020\u5668\u51fd\u6570\u3002\n\t<\/li>\n<li>\n\t\tSymbol.toPrimitive\uff1a\u4e00\u4e2a\u5c06\u5bf9\u8c61\u8f6c\u5316\u4e3a\u57fa\u672c\u6570\u636e\u7c7b\u578b\u7684\u65b9\u6cd5\u3002\n\t<\/li>\n<li>\n\t\tSymbol.toStringTag\uff1a\u7528\u4e8e\u5bf9\u8c61\u7684\u9ed8\u8ba4\u63cf\u8ff0\u7684\u5b57\u7b26\u4e32\u503c\u3002\u4f7f\u7528Object.prototype.toString()\u3002\n\t<\/li>\n<li>\n\t\tSymbol.prototype.constructor\uff1a\u8fd4\u56de\u521b\u5efa\u5b9e\u4f8b\u539f\u578b\u7684\u51fd\u6570. \u9ed8\u8ba4\u4e3a Symbol \u51fd\u6570\u3002\n\t<\/li>\n<\/ul>\n<h2>\n\tSymbol \u6d4f\u89c8\u5668\u517c\u5bb9\u6027<br \/>\n<\/h2>\n<p>\n\t<img decoding=\"async\" alt=\"Symbol \u6d4f\u89c8\u5668\u517c\u5bb9\u6027\" src=\"http:\/\/ordhqp1kx.bkt.clouddn.com\/symbol.png\" style=\"width: 647px;height: 325px\" \/>\n<\/p>\n<p>\n\tSymbol \u8fd8\u672a\u88ab\u5927\u8303\u56f4\u652f\u6301\uff0c\u63a8\u8350\u5927\u5bb6\u4f7f\u7528\u6700\u65b0\u7684\u8c37\u6b4c\u6d4f\u89c8\u5668\u8fdb\u884c\u6d4b\u8bd5\u3002<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=1652\">Symbol \u5c5e\u6027\u6c47\u603b<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>ES6 \u5f15\u5165\u4e86\u4e00\u4e9b\u5f88\u5b9e\u7528\u5f88\u5f3a\u5927\u7684\u7279\u6027\u548c\u4e00\u4e9b\u8bed\u6cd5\u3002\u4eca\u5929\u8bf4\u7684 Symbol \u5c31\u662f\u5176\u4e2d\u4e00\u4e2a\u3002 \u5bf9\u4e8e\u8fd9\u4e2a\u65b0\u7279\u6027\uff0c\u5f88\u591a\u4eba [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[1379,1106,1378],"class_list":["post-1652","post","type-post","status-publish","format-standard","hentry","category-html5","tag-es6","tag-javascript","tag-symbol"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1652","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1652"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1652\/revisions"}],"predecessor-version":[{"id":1653,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1652\/revisions\/1653"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1652"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1652"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1652"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}