{"id":29372,"date":"2024-11-25T15:41:33","date_gmt":"2024-11-25T07:41:33","guid":{"rendered":"https:\/\/fwq.ai\/blog\/29372\/"},"modified":"2024-11-25T15:41:33","modified_gmt":"2024-11-25T07:41:33","slug":"es6%e6%96%b0%e7%89%b9%e6%80%a7%e5%bc%80%e5%8f%91%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%ef%bc%884%ef%bc%89","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/29372\/","title":{"rendered":"ES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09"},"content":{"rendered":"<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">Symbol Type<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">ES6\u5f15\u5165\u4e86\u4e00\u79cd\u65b0\u7684\u539f\u59cb\u6570\u636e\u7c7b\u578bSymbol\uff0c\u8868\u793a\u72ec\u4e00\u65e0\u4e8c\u7684\u503c\u3002\u5b83\u662fJavaScript\u8bed\u8a00\u7684\u7b2c\u4e03\u79cd\u6570\u636e\u7c7b\u578b\uff0c\u524d\u516d\u79cd\u662f\uff1aUndefined\u3001Null\u3001\u5e03\u5c14\u503c(Boolean)\u3001\u5b57\u7b26\u4e32(String)\u3001\u6570\u503c(Number)\u3001\u5bf9\u8c61(Object)\u3002<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">Symbol\u503c\u901a\u8fc7Symbol\u51fd\u6570\u751f\u6210\u3002\u8fd9\u5c31\u662f\u8bf4\uff0c\u5bf9\u8c61\u7684\u5c5e\u6027\u540d\u73b0\u5728\u53ef\u4ee5\u6709\u4e24\u79cd\u7c7b\u578b\uff0c\u4e00\u79cd\u662f\u539f\u6765\u5c31\u6709\u7684\u5b57\u7b26\u4e32\uff0c\u53e6\u4e00\u79cd\u5c31\u662f\u65b0\u589e\u7684Symbol\u7c7b\u578b\u3002\u51e1\u662f\u5c5e\u6027\u540d\u5c5e\u4e8eSymbol\u7c7b\u578b\uff0c\u5c31\u90fd\u662f\u72ec\u4e00\u65e0\u4e8c\u7684\uff0c\u53ef\u4ee5\u4fdd\u8bc1\u4e0d\u4f1a\u4e0e\u5176\u4ed6\u5c5e\u6027\u540d\u4ea7\u751f\u51b2\u7a81\u3002<\/span><\/p>\n<p style=\"line-height:2em\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/010\/8b9c5030d7989c2d5d8b27b467e5f0ff-0.jpg\" class=\"aligncenter\" title=\"ES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09\u63d2\u56fe\" alt=\"ES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09\u63d2\u56fe\" \/><\/p>\n<p style=\"line-height:2em\"><span style=\"line-height:2em\">Iterators(\u8fed\u4ee3\u5668)<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">ES6\u8fed\u4ee3\u5668\u4e0d\u662f\u5185\u5efa\u7684\uff0c\u901a\u8fc7\u4f7f\u7528[Symbol.iterator]()\u548c.next()\u6765\u8fdb\u884c\u521b\u5efa\u3002Iterators(\u8fed\u4ee3\u5668)\u662f\u4e00\u79cd\u63a5\u53e3\uff0c\u4e3a\u5404\u79cd\u4e0d\u540c\u7684\u6570\u636e\u7ed3\u6784\u63d0\u4f9b\u7edf\u4e00\u7684\u8bbf\u95ee\u673a\u5236\u3002\u4efb\u4f55\u6570\u636e\u7ed3\u6784\u53ea\u8981\u90e8\u7f72Iterator\u63a5\u53e3\uff0c\u5c31\u53ef\u4ee5\u5b8c\u6210\u904d\u5386\u64cd\u4f5c(\u5373\u4f9d\u6b21\u5904\u7406\u8be5\u6570\u636e\u7ed3\u6784\u7684\u6240\u6709\u6210\u5458)\u3002<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">Iterator\u7684\u4f5c\u7528\uff1a<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">\u4e3a\u5404\u79cd\u6570\u636e\u7ed3\u6784\uff0c\u63d0\u4f9b\u4e00\u4e2a\u7edf\u4e00\u7684\u3001\u7b80\u4fbf\u7684\u8bbf\u95ee\u63a5\u53e3;<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">\u4f7f\u5f97\u6570\u636e\u7ed3\u6784\u7684\u6210\u5458\u80fd\u591f\u6309\u67d0\u79cd\u6b21\u5e8f\u6392\u5217;<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">ES6\u521b\u9020\u4e86\u4e00\u79cd\u65b0\u7684\u904d\u5386\u547d\u4ee4for&#8230;of\u5faa\u73af\uff0cIterator\u63a5\u53e3\u4e3b\u8981\u4f9bfor&#8230;of\u6d88\u8d39\u3002<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/010\/8b9c5030d7989c2d5d8b27b467e5f0ff-1.jpg\" class=\"aligncenter\" title=\"ES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09\u63d2\u56fe1\" alt=\"ES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09\u63d2\u56fe1\" \/><br \/><\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">Set\u3001Map\u6570\u636e\u7ed3\u6784<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">ES6\u63d0\u4f9b\u4e86\u65b0\u7684\u6570\u636e\u7ed3\u6784Set\u3002\u5b83\u7c7b\u4f3c\u4e8e\u6570\u7ec4\uff0c\u4f46\u662f\u6210\u5458\u7684\u503c\u90fd\u662f\u552f\u4e00\u7684\uff0c\u6ca1\u6709\u91cd\u590d\u7684\u503c\u3002<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">Set\u672c\u8eab\u662f\u4e00\u4e2a\u6784\u9020\u51fd\u6570\uff0c\u7528\u6765\u751f\u6210Set\u6570\u636e\u7ed3\u6784\u3002<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/010\/8b9c5030d7989c2d5d8b27b467e5f0ff-2.jpg\" class=\"aligncenter\" title=\"ES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09\u63d2\u56fe2\" alt=\"ES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09\u63d2\u56fe2\" \/><br \/><\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">ES6\u63d0\u4f9b\u4e86Map\u6570\u636e\u7ed3\u6784\u3002\u5b83\u7c7b\u4f3c\u4e8e\u5bf9\u8c61\uff0c\u4e5f\u662f\u952e\u503c\u5bf9\u7684\u96c6\u5408\uff0c\u4f46\u662f\u201c\u952e\u201d\u7684\u8303\u56f4\u4e0d\u9650\u4e8e\u5b57\u7b26\u4e32\uff0c\u5404\u79cd\u7c7b\u578b\u7684\u503c(\u5305\u62ec\u5bf9\u8c61)\u90fd\u53ef\u4ee5\u5f53\u4f5c\u952e\u3002\u4e5f\u5c31\u662f\u8bf4\uff0cObject\u7ed3\u6784\u63d0\u4f9b\u4e86\u201c\u5b57\u7b26\u4e32\u2014\u503c\u201d\u7684\u5bf9\u5e94\uff0cMap\u7ed3\u6784\u63d0\u4f9b\u4e86\u201c\u503c\u2014\u503c\u201d\u7684\u5bf9\u5e94\uff0c\u662f\u4e00\u79cd\u66f4\u5b8c\u5584\u7684Hash\u7ed3\u6784\u5b9e\u73b0\u3002\u5982\u679c\u4f60\u9700\u8981\u201c\u952e\u503c\u5bf9\u201d\u7684\u6570\u636e\u7ed3\u6784\uff0cMap\u6bd4Object\u66f4\u5408\u9002\u3002<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/010\/8b9c5030d7989c2d5d8b27b467e5f0ff-3.jpg\" class=\"aligncenter\" title=\"ES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09\u63d2\u56fe3\" alt=\"ES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09\u63d2\u56fe3\" \/><br \/><\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">WeakSet\u7ed3\u6784\u4e0eSet\u7c7b\u4f3c\uff0c\u4e5f\u662f\u4e0d\u91cd\u590d\u7684\u503c\u7684\u96c6\u5408\u3002\u4f46WeakSet\u53ea\u80fd\u5b58\u5bf9\u8c61\u7c7b\u578b\u7684\u5143\u7d20\uff0c\u6bd4\u5982\uff1aObject, Array, Function \u7b49\u3002WeakSet\u4e2d\u7684\u5bf9\u8c61\u90fd\u662f\u5f31\u5f15\u7528\uff0c\u5373\u5783\u573e\u56de\u6536\u673a\u5236\u4e0d\u8003\u8651WeakSet\u5bf9\u8be5\u5bf9\u8c61\u7684\u5f15\u7528\uff0c\u5982\u679c\u5176\u4ed6\u5bf9\u8c61\u90fd\u4e0d\u518d\u5f15\u7528\u8be5\u5bf9\u8c61\uff0c\u90a3\u4e48\u5783\u573e\u56de\u6536\u673a\u5236\u4f1a\u81ea\u52a8\u56de\u6536\u8be5\u5bf9\u8c61\u6240\u5360\u7528\u7684\u5185\u5b58\uff0c\u4e0d\u8003\u8651\u8be5\u5bf9\u8c61\u8fd8\u5b58\u5728\u4e8eWeakSet\u4e4b\u4e2d\u3002\u6709\u4e86\u5f31\u5f15\u7528\u7684WeakSet\uff0c \u5c31\u4e0d\u7528\u62c5\u5fc3\u5185\u5b58\u6cc4\u6f0f\u4e86\u3002<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">WeakSet\u5bf9\u8c61\u7684\u65b9\u6cd5\u53ea\u6709\u4e09\u4e2a\uff0cWeakMap\u6ca1\u6709size\u5c5e\u6027\uff1a<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">add(): \u5411\u96c6\u6dfb\u52a0\u65b0\u5143\u7d20\u3002<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">delete(): \u4ece\u96c6\u4e2d\u79fb\u9664\u6307\u5b9a\u5143\u7d20\u3002<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">has(): \u5982\u679c\u96c6\u5305\u542b\u6307\u5b9a\u7684\u5143\u7d20\uff0c\u5219\u8fd4\u56de true\u3002<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/010\/5ac197bfd22310ff2fc92326ba079e10-4.jpg\" class=\"aligncenter\" title=\"ES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09\u63d2\u56fe4\" alt=\"ES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09\u63d2\u56fe4\" \/><\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"line-height:2em\">WeakMap\u7ed3\u6784\u4e0eMap\u7ed3\u6784\u57fa\u672c\u7c7b\u4f3c\uff0c\u4e5f\u662f\u662f\u952e\u503c\u5bf9\u7684\u96c6\u5408\u3002\u4f46WeakMap\u53ea\u63a5\u53d7\u5bf9\u8c61\u4f5c\u4e3a\u952e\u540d(null\u9664\u5916)\uff0c\u4e0d\u63a5\u53d7\u5176\u4ed6\u7c7b\u578b\u7684\u503c\u4f5c\u4e3a\u952e\u540d\uff0c\u800c\u4e14\u952e\u540d\u6240\u6307\u5411\u7684\u5bf9\u8c61\uff0c\u4e0d\u8ba1\u5165\u5783\u573e\u56de\u6536\u673a\u5236\u3002<\/span><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\"><br \/><\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">WeakMap\u5bf9\u8c61\u7684\u65b9\u6cd5\uff0cWeakMap\u6ca1\u6709size\u5c5e\u6027\uff0cWeakMap\u5bf9\u8c61\u4e0d\u80fd\u679a\u4e3e\uff1a<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">clear():\u4ece WeakMap \u4e2d\u79fb\u9664\u6240\u6709\u5143\u7d20\u3002<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">delete(): \u4ece WeakMap \u4e2d\u79fb\u9664\u6307\u5b9a\u7684\u5143\u7d20\u3002<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">get(): \u4ece WeakMap \u4e2d\u8fd4\u56de\u6307\u5b9a\u7684\u5143\u7d20\u3002<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">has(): \u5982\u679c WeakMap \u5305\u542b\u6307\u5b9a\u5143\u7d20\uff0c\u5219\u8fd4\u56de true\u3002<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">set(): \u6dfb\u52a0\u65b0\u5143\u7d20\u81f3 WeakMap\u3002<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">toString():\u8fd4\u56de WeakMap \u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u3002<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">valueOf():\u8fd4\u56de\u6307\u5b9a\u5bf9\u8c61\u7684\u539f\u59cb\u503c\u3002<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/010\/5ac197bfd22310ff2fc92326ba079e10-5.jpg\" class=\"aligncenter\" title=\"ES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09\u63d2\u56fe5\" alt=\"ES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09\u63d2\u56fe5\" \/><\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">Typed Arrays(\u7c7b\u578b\u5316\u6570\u7ec4)<\/span><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\"><br \/><\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">\u7c7b\u578b\u5316\u6570\u7ec4(ArrayBuffer\u5bf9\u8c61\u3001TypedArray\u89c6\u56fe\u548cDataView\u89c6\u56fe)\u662fJavaScript\u64cd\u4f5c\u4e8c\u8fdb\u5236\u6570\u636e\u7684\u4e00\u4e2a\u63a5\u53e3\u3002\u8fd9\u4e9b\u5bf9\u8c61\u65e9\u5c31\u5b58\u5728\uff0c\u5c5e\u4e8e\u72ec\u7acb\u7684\u89c4\u683c(2011\u5e742\u6708\u53d1\u5e03)\uff0cES6\u5c06\u5b83\u4eec\u7eb3\u5165\u4e86ECMAScript\u89c4\u683c\uff0c\u5e76\u4e14\u589e\u52a0\u4e86\u65b0\u7684\u65b9\u6cd5\u3002<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">\u7c7b\u578b\u5316\u6570\u7ec4\u652f\u6301\u4efb\u610f\u57fa\u4e8e\u5b57\u8282\u7684\u6570\u636e\u7ed3\u6784\uff0c\u66f4\u65b9\u4fbf\u7684\u5b9e\u73b0\u7f51\u7edc\u534f\u8bae\u3001\u52a0\u5bc6\u7b97\u6cd5\u3001\u6587\u4ef6\u683c\u5f0f\u64cd\u4f5c\u7b49\u529f\u80fd\u3002<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">ArrayBuffer\u662f\u4e00\u6bb5\u4e0d\u900f\u660e\u7684\u5185\u5b58\u533a\u57df(\u6240\u8c13\u4e0d\u900f\u660e\uff0c\u5c31\u662f\u65e0\u6cd5\u76f4\u63a5\u64cd\u4f5c\u7684\u6570\u636e\u5757)\uff0c\u5355\u4f4d\u662f\u5b57\u8282(Byte)\u4e5f\u5c31\u662f8\u4f4d\uff0c\u5b83\u7684byteLength\u5c5e\u6027\u8fd4\u56de\u5176\u5185\u5b58\u5927\u5c0f\u3002<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"line-height:2em\">\u5728ArrayBuffer\u4e0a\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e0d\u540c\u7684\u89c6\u56fe\u6765\u521b\u5efa\u4efb\u610f\u6570\u91cf\u7684\u7c7b\u578b\u5316\u6570\u7ec4\uff0c \u8fd9\u4e9b\u7c7b\u578b\u5316\u6570\u7ec4\u4e5f\u53ef\u4ee5\u662f\u91cd\u53e0\u7684\u3002\u6709\u516b\u79cd\u4e0d\u540c\u7684\u7c7b\u578b\u5316\u6570\u7ec4(\u89c6\u56fe)\uff0c\u5206\u522b\u4e3a\uff1a<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/010\/5ac197bfd22310ff2fc92326ba079e10-6.jpg\" class=\"aligncenter\" title=\"ES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09\u63d2\u56fe6\" alt=\"ES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09\u63d2\u56fe6\" \/><\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">Int8Array: 1\u4e2a\u5b57\u8282\uff0c8\u4f4d\u4e8c\u8fdb\u5236\u5e26\u7b26\u53f7\u6574\u6570 -2^7~(2^7) &#8211; 1<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">Uint8Array: 1\u4e2a\u5b57\u8282\uff0c8\u4f4d\u65e0\u7b26\u53f7\u6574\u6570 0~(2^8) &#8211; 1<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">Int16Array: 2\u4e2a\u5b57\u8282\uff0c16\u4f4d\u4e8c\u8fdb\u5236\u5e26\u7b26\u53f7\u6574\u6570 -2^15~(2^15)-1<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">Uint16Array: 2\u4e2a\u5b57\u8282\uff0c16\u4f4d\u65e0\u7b26\u53f7\u6574\u6570 0~(2^16) &#8211; 1<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">Int32Array: 4\u4e2a\u5b57\u8282\uff0c32\u4f4d\u4e8c\u8fdb\u5236\u5e26\u7b26\u53f7\u6574\u6570 -2^31~(2^31)-1<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">Uint32Array: 4\u4e2a\u5b57\u8282\uff0c32\u4f4d\u65e0\u7b26\u53f7\u6574\u6570 0~(2^32) &#8211; 1<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">Float32Array: 4\u4e2a\u5b57\u8282\uff0c32\u4f4dIEEE\u6d6e\u70b9\u6570<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">Float64Array: 8\u4e2a\u5b57\u8282\uff0c64\u4f4dIEEE\u6d6e\u70b9\u6570<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/010\/5ac197bfd22310ff2fc92326ba079e10-7.jpg\" class=\"aligncenter\" title=\"ES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09\u63d2\u56fe7\" alt=\"ES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09\u63d2\u56fe7\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/010\/5ac197bfd22310ff2fc92326ba079e10-8.jpg\" class=\"aligncenter\" title=\"ES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09\u63d2\u56fe8\" alt=\"ES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09\u63d2\u56fe8\" \/><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/010\/868b754ec57d21457055fa7f6e988148-9.jpg\" class=\"aligncenter\" title=\"ES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09\u63d2\u56fe9\" alt=\"ES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09\u63d2\u56fe9\" \/><\/p>\n<p><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">\u5982\u679c\u4e00\u6bb5\u6570\u636e\u5305\u62ec\u591a\u79cd\u7c7b\u578b\uff0c\u8fd9\u65f6\u9664\u4e86\u5efa\u7acbArrayBuffer\u5bf9\u8c61\u7684\u590d\u5408\u89c6\u56fe\u4ee5\u5916\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7DataView\u89c6\u56fe\u8fdb\u884c\u64cd\u4f5c\u3002<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">DataView\u89c6\u56fe\u63d0\u4f9b\u66f4\u591a\u64cd\u4f5c\u9009\u9879\uff0c\u800c\u4e14\u652f\u6301\u8bbe\u5b9a\u5b57\u8282\u5e8f\u3002<\/span><\/p>\n<p style=\"line-height:2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\">DataView\u672c\u8eab\u4e5f\u662f\u6784\u9020\u51fd\u6570\uff0c\u63a5\u53d7\u4e00\u4e2aArrayBuffer\u5bf9\u8c61\u4f5c\u4e3a\u53c2\u6570\uff0c\u751f\u6210\u89c6\u56fe\u3002<\/span><\/p>\n<p style=\"line-height: 2em\"><span style=\"font-family:\u5fae\u8f6f\u96c5\u9ed1,\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/010\/868b754ec57d21457055fa7f6e988148-10.jpg\" class=\"aligncenter\" title=\"ES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09\u63d2\u56fe10\" alt=\"ES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09\u63d2\u56fe10\" \/><\/span><\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fES6\u65b0\u7279\u6027\u5f00\u53d1\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\uff084\uff09\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Symbol Type ES6\u5f15\u5165\u4e86\u4e00\u79cd\u65b0\u7684\u539f\u59cb\u6570\u636e\u7c7b\u578bSymbol\uff0c\u8868\u793a\u72ec\u4e00\u65e0\u4e8c\u7684\u503c\u3002\u5b83\u662fJavaScript\u8bed\u8a00\u7684\u7b2c\u4e03\u79cd\u6570\u636e\u7c7b\u578b\uff0c\u524d\u516d\u79cd\u662f\uff1aUndefined\u3001Null\u3001\u5e03\u5c14\u503c(Boolean)\u3001\u5b57\u7b26\u4e32(String)\u3001\u6570\u503c(Number)\u3001\u5bf9\u8c61(Object)\u3002 Symbol\u503c\u901a\u8fc7Symbol\u51fd\u6570\u751f\u6210\u3002\u8fd9\u5c31\u662f\u8bf4\uff0c\u5bf9\u8c61\u7684\u5c5e\u6027\u540d\u73b0\u5728\u53ef\u4ee5\u6709\u4e24\u79cd\u7c7b\u578b\uff0c\u4e00\u79cd\u662f\u539f\u6765\u5c31\u6709\u7684\u5b57\u7b26\u4e32\uff0c\u53e6\u4e00\u79cd\u5c31\u662f\u65b0\u589e\u7684Symbol\u7c7b\u578b\u3002\u51e1\u662f\u5c5e\u6027\u540d\u5c5e\u4e8eSymbol\u7c7b\u578b\uff0c\u5c31\u90fd\u662f\u72ec\u4e00\u65e0\u4e8c\u7684\uff0c\u53ef\u4ee5\u4fdd\u8bc1\u4e0d\u4f1a\u4e0e\u5176\u4ed6\u5c5e\u6027\u540d\u4ea7\u751f\u51b2\u7a81\u3002 Iterators(\u8fed\u4ee3\u5668) ES6\u8fed\u4ee3\u5668\u4e0d\u662f\u5185\u5efa\u7684\uff0c\u901a\u8fc7\u4f7f\u7528[Symbol.iterator]()\u548c.next()\u6765\u8fdb\u884c\u521b\u5efa\u3002Iterators(\u8fed\u4ee3\u5668)\u662f\u4e00\u79cd\u63a5\u53e3\uff0c\u4e3a\u5404\u79cd\u4e0d\u540c\u7684\u6570\u636e\u7ed3\u6784\u63d0\u4f9b\u7edf\u4e00\u7684\u8bbf\u95ee\u673a\u5236\u3002\u4efb\u4f55\u6570\u636e\u7ed3\u6784\u53ea\u8981\u90e8\u7f72Iterator\u63a5\u53e3\uff0c\u5c31\u53ef\u4ee5\u5b8c\u6210\u904d\u5386\u64cd\u4f5c(\u5373\u4f9d\u6b21\u5904\u7406\u8be5\u6570\u636e\u7ed3\u6784\u7684\u6240\u6709\u6210\u5458)\u3002 Iterator\u7684\u4f5c\u7528\uff1a \u4e3a\u5404\u79cd\u6570\u636e\u7ed3\u6784\uff0c\u63d0\u4f9b\u4e00\u4e2a\u7edf\u4e00\u7684\u3001\u7b80\u4fbf\u7684\u8bbf\u95ee\u63a5\u53e3; \u4f7f\u5f97\u6570\u636e\u7ed3\u6784\u7684\u6210\u5458\u80fd\u591f\u6309\u67d0\u79cd\u6b21\u5e8f\u6392\u5217; ES6\u521b\u9020\u4e86\u4e00\u79cd\u65b0\u7684\u904d\u5386\u547d\u4ee4for&#8230;of\u5faa\u73af\uff0cIterator\u63a5\u53e3\u4e3b\u8981\u4f9bfor&#8230;of\u6d88\u8d39\u3002 Set\u3001Map\u6570\u636e\u7ed3\u6784 ES6\u63d0\u4f9b\u4e86\u65b0\u7684\u6570\u636e\u7ed3\u6784Set\u3002\u5b83\u7c7b\u4f3c\u4e8e\u6570\u7ec4\uff0c\u4f46\u662f\u6210\u5458\u7684\u503c\u90fd\u662f\u552f\u4e00\u7684\uff0c\u6ca1\u6709\u91cd\u590d\u7684\u503c\u3002 Set\u672c\u8eab\u662f\u4e00\u4e2a\u6784\u9020\u51fd\u6570\uff0c\u7528\u6765\u751f\u6210Set\u6570\u636e\u7ed3\u6784\u3002 ES6\u63d0\u4f9b\u4e86Map\u6570\u636e\u7ed3\u6784\u3002\u5b83\u7c7b\u4f3c\u4e8e\u5bf9\u8c61\uff0c\u4e5f\u662f\u952e\u503c\u5bf9\u7684\u96c6\u5408\uff0c\u4f46\u662f\u201c\u952e\u201d\u7684\u8303\u56f4\u4e0d\u9650\u4e8e\u5b57\u7b26\u4e32\uff0c\u5404\u79cd\u7c7b\u578b\u7684\u503c(\u5305\u62ec\u5bf9\u8c61)\u90fd\u53ef\u4ee5\u5f53\u4f5c\u952e\u3002\u4e5f\u5c31\u662f\u8bf4\uff0cObject\u7ed3\u6784\u63d0\u4f9b\u4e86\u201c\u5b57\u7b26\u4e32\u2014\u503c\u201d\u7684\u5bf9\u5e94\uff0cMap\u7ed3\u6784\u63d0\u4f9b\u4e86\u201c\u503c\u2014\u503c\u201d\u7684\u5bf9\u5e94\uff0c\u662f\u4e00\u79cd\u66f4\u5b8c\u5584\u7684Hash\u7ed3\u6784\u5b9e\u73b0\u3002\u5982\u679c\u4f60\u9700\u8981\u201c\u952e\u503c\u5bf9\u201d\u7684\u6570\u636e\u7ed3\u6784\uff0cMap\u6bd4Object\u66f4\u5408\u9002\u3002 WeakSet\u7ed3\u6784\u4e0eSet\u7c7b\u4f3c\uff0c\u4e5f\u662f\u4e0d\u91cd\u590d\u7684\u503c\u7684\u96c6\u5408\u3002\u4f46WeakSet\u53ea\u80fd\u5b58\u5bf9\u8c61\u7c7b\u578b\u7684\u5143\u7d20\uff0c\u6bd4\u5982\uff1aObject, Array, Function \u7b49\u3002WeakSet\u4e2d\u7684\u5bf9\u8c61\u90fd\u662f\u5f31\u5f15\u7528\uff0c\u5373\u5783\u573e\u56de\u6536\u673a\u5236\u4e0d\u8003\u8651WeakSet\u5bf9\u8be5\u5bf9\u8c61\u7684\u5f15\u7528\uff0c\u5982\u679c\u5176\u4ed6\u5bf9\u8c61\u90fd\u4e0d\u518d\u5f15\u7528\u8be5\u5bf9\u8c61\uff0c\u90a3\u4e48\u5783\u573e\u56de\u6536\u673a\u5236\u4f1a\u81ea\u52a8\u56de\u6536\u8be5\u5bf9\u8c61\u6240\u5360\u7528\u7684\u5185\u5b58\uff0c\u4e0d\u8003\u8651\u8be5\u5bf9\u8c61\u8fd8\u5b58\u5728\u4e8eWeakSet\u4e4b\u4e2d\u3002\u6709\u4e86\u5f31\u5f15\u7528\u7684WeakSet\uff0c \u5c31\u4e0d\u7528\u62c5\u5fc3\u5185\u5b58\u6cc4\u6f0f\u4e86\u3002 WeakSet\u5bf9\u8c61\u7684\u65b9\u6cd5\u53ea\u6709\u4e09\u4e2a\uff0cWeakMap\u6ca1\u6709size\u5c5e\u6027\uff1a add(): \u5411\u96c6\u6dfb\u52a0\u65b0\u5143\u7d20\u3002 delete(): \u4ece\u96c6\u4e2d\u79fb\u9664\u6307\u5b9a\u5143\u7d20\u3002 has(): \u5982\u679c\u96c6\u5305\u542b\u6307\u5b9a\u7684\u5143\u7d20\uff0c\u5219\u8fd4\u56de true\u3002 WeakMap\u7ed3\u6784\u4e0eMap\u7ed3\u6784\u57fa\u672c\u7c7b\u4f3c\uff0c\u4e5f\u662f\u662f\u952e\u503c\u5bf9\u7684\u96c6\u5408\u3002\u4f46WeakMap\u53ea\u63a5\u53d7\u5bf9\u8c61\u4f5c\u4e3a\u952e\u540d(null\u9664\u5916)\uff0c\u4e0d\u63a5\u53d7\u5176\u4ed6\u7c7b\u578b\u7684\u503c\u4f5c\u4e3a\u952e\u540d\uff0c\u800c\u4e14\u952e\u540d\u6240\u6307\u5411\u7684\u5bf9\u8c61\uff0c\u4e0d\u8ba1\u5165\u5783\u573e\u56de\u6536\u673a\u5236\u3002 WeakMap\u5bf9\u8c61\u7684\u65b9\u6cd5\uff0cWeakMap\u6ca1\u6709size\u5c5e\u6027\uff0cWeakMap\u5bf9\u8c61\u4e0d\u80fd\u679a\u4e3e\uff1a clear():\u4ece WeakMap \u4e2d\u79fb\u9664\u6240\u6709\u5143\u7d20\u3002 delete(): \u4ece WeakMap \u4e2d\u79fb\u9664\u6307\u5b9a\u7684\u5143\u7d20\u3002 get(): \u4ece WeakMap \u4e2d\u8fd4\u56de\u6307\u5b9a\u7684\u5143\u7d20\u3002 has(): \u5982\u679c WeakMap \u5305\u542b\u6307\u5b9a\u5143\u7d20\uff0c\u5219\u8fd4\u56de true\u3002 set(): \u6dfb\u52a0\u65b0\u5143\u7d20\u81f3 WeakMap\u3002 toString():\u8fd4\u56de WeakMap \u7684\u5b57\u7b26\u4e32\u8868\u793a\u5f62\u5f0f\u3002 valueOf():\u8fd4\u56de\u6307\u5b9a\u5bf9\u8c61\u7684\u539f\u59cb\u503c\u3002 Typed Arrays(\u7c7b\u578b\u5316\u6570\u7ec4) \u7c7b\u578b\u5316\u6570\u7ec4(ArrayBuffer\u5bf9\u8c61\u3001TypedArray\u89c6\u56fe\u548cDataView\u89c6\u56fe)\u662fJavaScript\u64cd\u4f5c\u4e8c\u8fdb\u5236\u6570\u636e\u7684\u4e00\u4e2a\u63a5\u53e3\u3002\u8fd9\u4e9b\u5bf9\u8c61\u65e9\u5c31\u5b58\u5728\uff0c\u5c5e\u4e8e\u72ec\u7acb\u7684\u89c4\u683c(2011\u5e742\u6708\u53d1\u5e03)\uff0cES6\u5c06\u5b83\u4eec\u7eb3\u5165\u4e86ECMAScript\u89c4\u683c\uff0c\u5e76\u4e14\u589e\u52a0\u4e86\u65b0\u7684\u65b9\u6cd5\u3002 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-29372","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/29372","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=29372"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/29372\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=29372"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=29372"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=29372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}