{"id":234,"date":"2026-04-08T19:56:07","date_gmt":"2026-04-08T11:56:07","guid":{"rendered":"https:\/\/arknight.wiki\/?p=234"},"modified":"2026-04-08T19:56:08","modified_gmt":"2026-04-08T11:56:08","slug":"typescript%e5%8f%8ajavascript-%e5%9f%ba%e7%a1%80%e8%af%ad%e6%b3%95","status":"publish","type":"post","link":"https:\/\/arknight.wiki\/index.php\/2026\/04\/08\/typescript%e5%8f%8ajavascript-%e5%9f%ba%e7%a1%80%e8%af%ad%e6%b3%95\/","title":{"rendered":"TypeScript\u53caJavaScript \u57fa\u7840\u8bed\u6cd5"},"content":{"rendered":"<h1>JavaScript \u57fa\u7840\u8bed\u6cd5<\/h1>\n<h3>1. <strong>\u53d8\u91cf\u58f0\u660e<\/strong><\/h3>\n<pre><code>\/\/ const - \u5e38\u91cf\uff08\u4e0d\u80fd\u91cd\u65b0\u8d4b\u503c\uff09\nconst name = \"Alice\";\nconst numbers = [1, 2, 3];\n\n\/\/ let - \u53ef\u53d8\u53d8\u91cf\nlet count = 0;\ncount = 1;  \/\/ \u2705 \u53ef\u4ee5\u4fee\u6539\n\n\/\/ var - \u4e0d\u63a8\u8350\u4f7f\u7528\uff08\u6709\u4f5c\u7528\u57df\u95ee\u9898\uff09\nvar oldWay = \"avoid this\";<\/code><\/pre>\n<h3>2. <strong>\u6570\u636e\u7c7b\u578b<\/strong><\/h3>\n<pre><code>\/\/ \u57fa\u672c\u7c7b\u578b\nconst str: string = \"hello\";\nconst num: number = 42;\nconst bool: boolean = true;\nconst arr: number[] = [1, 2, 3];\n\n\/\/ \u7c7b\u578b\u53ef\u4ee5\u63a8\u65ad\uff08\u4e0d\u9700\u8981\u663e\u5f0f\u58f0\u660e\uff09\nconst inferred = \"TypeScript knows this is a string\";<\/code><\/pre>\n<h3>3. <strong>\u51fd\u6570<\/strong><\/h3>\n<pre><code>\/\/ \u666e\u901a\u51fd\u6570\nfunction add(a: number, b: number): number {\n  return a + b;\n}\n\n\/\/ \u7bad\u5934\u51fd\u6570\uff08\u66f4\u7b80\u6d01\uff09\nconst multiply = (a: number, b: number): number =&gt; {\n  return a * b;\n};\n\n\/\/ \u7b80\u5199\u7bad\u5934\u51fd\u6570\nconst square = (x: number) =&gt; x * x;\n\n\/\/ \u5f02\u6b65\u51fd\u6570\uff08\u8fd4\u56de Promise\uff09\nasync function fetchData(url: string): Promise&lt;string&gt; {\n  const response = await fetch(url);\n  return await response.text();\n}<\/code><\/pre>\n<h3>4. <strong>\u5bf9\u8c61<\/strong><\/h3>\n<pre><code>\/\/ \u521b\u5efa\u5bf9\u8c61\nconst person = {\n  name: \"Alice\",\n  age: 30,\n  greet() {\n    console.log(`Hello, I'm ${this.name}`);\n  }\n};\n\n\/\/ \u8bbf\u95ee\u5c5e\u6027\nconsole.log(person.name);      \/\/ \u70b9\u8868\u793a\u6cd5\nconsole.log(person[\"age\"]);    \/\/ \u65b9\u62ec\u53f7\u8868\u793a\u6cd5\n\n\/\/ \u5bf9\u8c61\u89e3\u6784\nconst { name, age } = person;<\/code><\/pre>\n<h3>5. <strong>\u7c7b\uff08Class\uff09<\/strong><\/h3>\n<pre><code>class Person {\n  name: string;\n  age: number;\n\n  constructor(name: string, age: number) {\n    this.name = name;\n    this.age = age;\n  }\n\n  greet() {\n    console.log(`Hello, I'm ${this.name}`);\n  }\n}\n\nconst alice = new Person(\"Alice\", 30);\nalice.greet();<\/code><\/pre>\n<h3>6. <strong>\u6570\u7ec4\u65b9\u6cd5<\/strong><\/h3>\n<pre><code>const numbers = [1, 2, 3, 4, 5];\n\n\/\/ map - \u8f6c\u6362\u6570\u7ec4\nconst doubled = numbers.map(n =&gt; n * 2);  \/\/ [2, 4, 6, 8, 10]\n\n\/\/ filter - \u8fc7\u6ee4\u6570\u7ec4\nconst evens = numbers.filter(n =&gt; n % 2 === 0);  \/\/ [2, 4]\n\n\/\/ forEach - \u904d\u5386\nnumbers.forEach(n =&gt; console.log(n));\n\n\/\/ find - \u67e5\u627e\nconst found = numbers.find(n =&gt; n &gt; 3);  \/\/ 4\n\n\/\/ reduce - \u5f52\u7ea6\nconst sum = numbers.reduce((acc, n) =&gt; acc + n, 0);  \/\/ 15<\/code><\/pre>\n<h3>7. <strong>\u6761\u4ef6\u8bed\u53e5<\/strong><\/h3>\n<pre><code>\/\/ if-else\nif (age &gt;= 18) {\n  console.log(\"Adult\");\n} else {\n  console.log(\"Minor\");\n}\n\n\/\/ \u4e09\u5143\u8fd0\u7b97\u7b26\nconst status = age &gt;= 18 ? \"adult\" : \"minor\";\n\n\/\/ switch\nswitch (day) {\n  case \"Monday\":\n    console.log(\"Start of week\");\n    break;\n  default:\n    console.log(\"Other day\");\n}<\/code><\/pre>\n<h3>8. <strong>\u5faa\u73af<\/strong><\/h3>\n<pre><code>\/\/ for \u5faa\u73af\nfor (let i = 0; i &lt; 5; i++) {\n  console.log(i);\n}\n\n\/\/ for...of\uff08\u904d\u5386\u6570\u7ec4\uff09\nfor (const item of [1, 2, 3]) {\n  console.log(item);\n}\n\n\/\/ for...in\uff08\u904d\u5386\u5bf9\u8c61\u5c5e\u6027\uff09\nconst obj = { a: 1, b: 2 };\nfor (const key in obj) {\n  console.log(key, obj[key]);\n}\n\n\/\/ while \u5faa\u73af\nwhile (count &lt; 10) {\n  count++;\n}<\/code><\/pre>\n<h3>9. <strong>\u5f02\u5e38\u5904\u7406<\/strong><\/h3>\n<pre><code>try {\n  const result = riskyOperation();\n  console.log(result);\n} catch (error) {\n  console.error(\"Error:\", error.message);\n} finally {\n  console.log(\"Always executes\");\n}\n\n\/\/ \u629b\u51fa\u9519\u8bef\nthrow new Error(\"Something went wrong\");<\/code><\/pre>\n<h3>10. <strong>\u6a21\u677f\u5b57\u7b26\u4e32<\/strong><\/h3>\n<pre><code>const name = \"Alice\";\nconst age = 30;\n\n\/\/ \u4f7f\u7528\u53cd\u5f15\u53f7\nconst message = `Hello, I'm ${name} and I'm ${age} years old`;\n\n\/\/ \u591a\u884c\u5b57\u7b26\u4e32\nconst html = `\n  &lt;div&gt;\n    &lt;h1&gt;${name}&lt;\/h1&gt;\n    &lt;p&gt;Age: ${age}&lt;\/p&gt;\n  &lt;\/div&gt;\n`;<\/code><\/pre>\n<h3>11. <strong>JSON \u64cd\u4f5c<\/strong><\/h3>\n<pre><code>\/\/ \u5bf9\u8c61\u8f6c JSON \u5b57\u7b26\u4e32\nconst obj = { name: \"Alice\", age: 30 };\nconst jsonString = JSON.stringify(obj);\n\/\/ \u2192 '{\"name\":\"Alice\",\"age\":30}'\n\n\/\/ JSON \u5b57\u7b26\u4e32\u8f6c\u5bf9\u8c61\nconst parsed = JSON.parse(jsonString);\n\/\/ \u2192 { name: \"Alice\", age: 30 }\n\n\/\/ \u683c\u5f0f\u5316\u8f93\u51fa\nconst pretty = JSON.stringify(obj, null, 2);\n\/*\n{\n  \"name\": \"Alice\",\n  \"age\": 30\n}\n*\/<\/code><\/pre>\n<h3>12. <strong>Fetch API\uff08\u7f51\u7edc\u8bf7\u6c42\uff09<\/strong><\/h3>\n<pre><code>\/\/ GET \u8bf7\u6c42\nasync function getData(url: string) {\n  const response = await fetch(url);\n  const data = await response.json();\n  return data;\n}\n\n\/\/ POST \u8bf7\u6c42\nasync function postData(url: string, data: object) {\n  const response = await fetch(url, {\n    method: \"POST\",\n    headers: {\n      \"Content-Type\": \"application\/json\"\n    },\n    body: JSON.stringify(data)\n  });\n  return await response.json();\n}<\/code><\/pre>\n<h2>13\uff1aexport default\uff1a<\/h2>\n<p>\u5728\u4e00\u4e9b\u5e73\u53f0\u4e2d\u6bcf\u4e2a <code>.ts<\/code> \u6587\u4ef6\u662f\u4e00\u4e2a\u6a21\u5757\uff0c<code>export default<\/code>\u5c31\u662f\u544a\u8bc9\u5e73\u53f0\u4e3b\u8981\u529f\u80fd\u4ece\u54ea\u91cc\u5f00\u59cb\u8fd0\u884c\u3002<\/p>\n<h2>14\uff1a\u8c03\u8bd5\u57fa\u7840\uff1a<\/h2>\n<pre><code>export default {\n  async fetch(req) {\n    const out = {\n      runtime_type: typeof __runtime,\n      runtime_keys: Object.getOwnPropertyNames(__runtime).sort(),\n      runtime_symbols: Object.getOwnPropertySymbols(__runtime).map(String),\n    };\n    return new Response(JSON.stringify(out, null, 2), {\n      headers: { \"content-type\": \"application\/json\" },\n    });\n  },\n};<\/code><\/pre>\n<p><code>Object.getOwnPropertyNames(__runtime)<\/code>\uff1a<\/p>\n<ul>\n<li>\u8fd4\u56de\u5bf9\u8c61\u201c\u81ea\u8eab\u201d\u7684\u5c5e\u6027\u540d<\/li>\n<li>\u53ea\u8fd4\u56de\u5b57\u7b26\u4e32\u952e<\/li>\n<li>\u5305\u62ec\u4e0d\u53ef\u679a\u4e3e\u5c5e\u6027<\/li>\n<li>\u4e0d\u4f1a\u5f80\u539f\u578b\u94fe\u4e0a\u627e<\/li>\n<\/ul>\n<p><code>Object.keys<\/code> \uff1a\u53ea\u8fd4\u56de\u201c\u53ef\u679a\u4e3e\u7684\u5b57\u7b26\u4e32\u952e\u201d<\/p>\n<p><code>sort()<\/code>\uff1a\u6570\u7ec4\u6392\u5e8f\uff0c\u539f\u5730\u4fee\u6539<\/p>\n<p><code>Symbol<\/code>\uff1a\u662f JavaScript \u7684<strong>\u7b2c7\u79cd\u57fa\u672c\u6570\u636e\u7c7b\u578b<\/strong>\uff08ES6 \u65b0\u589e\uff09\uff0c\u7528\u4e8e\u521b\u5efa<strong>\u552f\u4e00\u7684\u6807\u8bc6\u7b26<\/strong>\u3002\u5e38\u7528\u4e8e\u521b\u5efa\u9690\u85cf\u5c5e\u6027<\/p>\n<p><code>Object.getOwnPropertySymbols(__runtime)<\/code>\uff1a\u5355\u72ec\u679a\u4e3e symbol \u952e\uff0c\u662f\u56e0\u4e3a\u6709\u4e9b\u5185\u90e8\u80fd\u529b\u559c\u6b22\u85cf\u5728 symbol \u5c5e\u6027\u4e0a\u3002<\/p>\n<p><code>JSON.stringify(out, null, 2)<\/code>\uff1a\u628a JavaScript \u503c\u8f6c\u6210 JSON \u5b57\u7b26\u4e32\u3002<\/p>\n<p>\u4e09\u4e2a\u53c2\u6570\u5206\u522b\u8868\u793a\uff1a<\/p>\n<ul>\n<li>\u8981\u5e8f\u5217\u5316\u7684\u503c<\/li>\n<li>replacer\uff0c\u8fd9\u91cc\u4f20 <code>null<\/code> \u8868\u793a\u4e0d\u7528\u81ea\u5b9a\u4e49\u5904\u7406<\/li>\n<li>\u7f29\u8fdb\u7a7a\u683c\u6570\uff0c\u8fd9\u91cc\u4f20 <code>2<\/code> \u8868\u793a\u683c\u5f0f\u5316\u8f93\u51fa<\/li>\n<\/ul>\n<h3>\u4e00\u4e9b\u5176\u4ed6api\uff1a<\/h3>\n<p>\u4e0b\u9762\u662f\u6700\u91cd\u8981\u7684\u51e0\u4e2a\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>API<\/th>\n<th>\u8fd4\u56de\u4ec0\u4e48<\/th>\n<th>\u4f1a\u4e0d\u4f1a\u6f0f\u9690\u85cf\u5c5e\u6027<\/th>\n<th>\u4f1a\u4e0d\u4f1a\u62ff\u5230 symbol<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>Object.keys(obj)<\/code><\/td>\n<td>\u81ea\u8eab\u7684\u53ef\u679a\u4e3e\u5b57\u7b26\u4e32\u952e<\/td>\n<td>\u4f1a<\/td>\n<td>\u4e0d\u4f1a<\/td>\n<\/tr>\n<tr>\n<td><code>Object.getOwnPropertyNames(obj)<\/code><\/td>\n<td>\u81ea\u8eab\u7684\u6240\u6709\u5b57\u7b26\u4e32\u952e<\/td>\n<td>\u4e0d\u5bb9\u6613\u6f0f<\/td>\n<td>\u4e0d\u4f1a<\/td>\n<\/tr>\n<tr>\n<td><code>Object.getOwnPropertySymbols(obj)<\/code><\/td>\n<td>\u81ea\u8eab\u7684\u6240\u6709 symbol \u952e<\/td>\n<td>\u4e0d\u5bb9\u6613\u6f0f<\/td>\n<td>\u4f1a<\/td>\n<\/tr>\n<tr>\n<td><code>Reflect.ownKeys(obj)<\/code><\/td>\n<td>\u81ea\u8eab\u7684\u6240\u6709\u952e<\/td>\n<td>\u6700\u5b8c\u6574<\/td>\n<td>\u4f1a<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<pre><code>export default {\n  async fetch(req) {\n    const targets = {\n      runtime: __runtime,\n      internal: __runtime._internal,\n      lib: __runtime._internal.lib,\n      symbols: __runtime._internal.lib.symbols,\n      secrets: __runtime._secrets,\n    };\n\n    const out = {};\n    for (const [name, obj] of Object.entries(targets)) {\n      const keys = Reflect.ownKeys(obj || {}).map((k) =&gt;\n        typeof k === \"symbol\" ? k.toString() : k\n      );\n      out[name] = { keys };\n    }\n\n    return new Response(JSON.stringify(out, null, 2), {\n      headers: { \"content-type\": \"application\/json\" },\n    });\n  },\n};<\/code><\/pre>\n<p><code>Object.entries(obj)<\/code> \u4f1a\u8fd4\u56de\u4e00\u4e2a\u6570\u7ec4\uff0c\u6570\u7ec4\u91cc\u6bcf\u9879\u90fd\u662f <code>[key, value]<\/code>\u3002<\/p>\n<p>\u4f8b\u5982\uff1a<\/p>\n<pre><code>Object.entries({ a: 1, b: 2 })\n\/\/ [[\"a\", 1], [\"b\", 2]]<\/code><\/pre>\n<h2>\u5c5e\u6027\u63cf\u8ff0\u7b26\uff1a<\/h2>\n<p>\u5728 JavaScript \u91cc\uff0c\u4e00\u4e2a\u5c5e\u6027\u4e0d\u53ea\u662f\u201c\u6709\u503c\u201d\u8fd9\u4e48\u7b80\u5355\uff0c\u5b83\u8fd8\u6709\u5143\u4fe1\u606f\uff1a<\/p>\n<ol>\n<li><code>value<\/code><\/li>\n<li><code>writable<\/code><\/li>\n<li><code>enumerable<\/code><\/li>\n<li><code>configurable<\/code><\/li>\n<li>\u6216\u8005 <code>get<\/code><\/li>\n<li>\u6216\u8005 <code>set<\/code><\/li>\n<\/ol>\n<p>\u53ef\u4ee5\u7528\uff1a<\/p>\n<pre><code>Object.getOwnPropertyDescriptor(obj, \"x\")<\/code><\/pre>\n<p>\u6765\u770b\u67d0\u4e2a\u5c5e\u6027\u7684\u63cf\u8ff0\u7b26\u3002<\/p>\n<p>\u4f8b\uff1a<\/p>\n<pre><code>const obj = {};\nObject.defineProperty(obj, \"hidden\", {\n  value: 123,\n  enumerable: false,\n  writable: false,\n  configurable: false,\n});\n\nObject.getOwnPropertyDescriptor(obj, \"hidden\");<\/code><\/pre>\n<p>\u8fd4\u56de\uff1a<\/p>\n<pre><code>const obj = {};\nObject.defineProperty(obj, \"hidden\", {\n  value: 123,\n  enumerable: false,\n  writable: false,\n  configurable: false,\n});\n\nObject.getOwnPropertyDescriptor(obj, \"hidden\");<\/code><\/pre>\n<h2>\u5341\u516d\u8fdb\u5236\u89e3\u7801\u5668\uff1a<\/h2>\n<pre><code>function hexToAscii(hex) {\n  return hex\n    .match(\/..\/g)\n    .map((h) =&gt; String.fromCharCode(parseInt(h, 16)))\n    .join(\"\");\n}\n\nhexToAscii(\"72656164\"); \/\/ \"read\"\nhexToAscii(\"6c697374\"); \/\/ \"list\"<\/code><\/pre>\n<p>\u8fd9\u91cc\u4f60\u53c8\u80fd\u987a\u4fbf\u5b66\u5230\u51e0\u4e2a\u51fd\u6570\uff1a<\/p>\n<ul>\n<li><code>match(\/..\/g)<\/code>\uff1a\u6bcf\u4e24\u4e2a\u5b57\u7b26\u5207\u4e00\u7ec4<\/li>\n<li><code>parseInt(h, 16)<\/code>\uff1a\u6309\u5341\u516d\u8fdb\u5236\u89e3\u6790\u5b57\u7b26\u4e32<\/li>\n<li><code>String.fromCharCode(...)<\/code>\uff1a\u628a\u5b57\u7b26\u7f16\u7801\u8f6c\u6210\u5b57\u7b26<\/li>\n<li><code>join(\"\")<\/code>\uff1a\u628a\u6570\u7ec4\u62fc\u6210\u5b57\u7b26\u4e32<\/li>\n<\/ul>\n<p><code>TextEncoder<\/code> \u548c<code>TextDecoder<\/code>\uff1a\u5c06\u5b57\u7b26\u4e32\u8ddf\u5b57\u8282\u6570\u7ec4\u8f6c\u6362<\/p>\n<p>\u4f8b\uff1a<\/p>\n<pre><code>const encoder = new TextEncoder();\nconst bytes = encoder.encode(\"ABC\"); \nconst decoder = new TextDecoder();\nconst text = decoder.decode(bytes);<\/code><\/pre>\n<h2>\u9ad8\u9891\u51fd\u6570 \/ \u8bed\u6cd5\u901f\u67e5\u8868<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u5199\u6cd5<\/th>\n<th>\u4f5c\u7528<\/th>\n<th>\u4f60\u5e94\u8be5\u600e\u4e48\u8bb0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>export default ...<\/code><\/td>\n<td>\u9ed8\u8ba4\u5bfc\u51fa\u6a21\u5757\u5185\u5bb9<\/td>\n<td>\u5e73\u53f0\u8981\u62ff\u4f60\u7684\u5165\u53e3\u5bf9\u8c61<\/td>\n<\/tr>\n<tr>\n<td><code>async fetch(req) {}<\/code><\/td>\n<td>\u5f02\u6b65\u65b9\u6cd5<\/td>\n<td>Worker \u5165\u53e3\u51fd\u6570<\/td>\n<\/tr>\n<tr>\n<td><code>new Response(body, init)<\/code><\/td>\n<td>\u6784\u9020 HTTP \u54cd\u5e94<\/td>\n<td>\u4f60\u7684\u8fd4\u56de\u503c<\/td>\n<\/tr>\n<tr>\n<td><code>await fetch(url, options)<\/code><\/td>\n<td>\u53d1\u8bf7\u6c42\u5e76\u7b49\u5f85\u7ed3\u679c<\/td>\n<td>Web API\uff0c\u4e0d\u662f\u5165\u53e3\u51fd\u6570<\/td>\n<\/tr>\n<tr>\n<td><code>typeof x<\/code><\/td>\n<td>\u770b\u503c\u7684\u5927\u7c7b\u7c7b\u578b<\/td>\n<td>\u5148\u786e\u8ba4\u5bf9\u8c61\u5b58\u5728\u4e0e\u5426<\/td>\n<\/tr>\n<tr>\n<td><code>Object.getOwnPropertyNames(obj)<\/code><\/td>\n<td>\u679a\u4e3e\u81ea\u6709\u5b57\u7b26\u4e32\u952e<\/td>\n<td>\u63a2\u9690\u85cf\u5c5e\u6027\u5e38\u7528<\/td>\n<\/tr>\n<tr>\n<td><code>Object.getOwnPropertySymbols(obj)<\/code><\/td>\n<td>\u679a\u4e3e symbol \u952e<\/td>\n<td>\u9632\u6b62\u6f0f\u6389 symbol<\/td>\n<\/tr>\n<tr>\n<td><code>Reflect.ownKeys(obj)<\/code><\/td>\n<td>\u679a\u4e3e\u5168\u90e8\u81ea\u6709\u952e<\/td>\n<td>\u6700\u5b8c\u6574<\/td>\n<\/tr>\n<tr>\n<td><code>Object.entries(obj)<\/code><\/td>\n<td>\u5f97\u5230 <code>[key, value]<\/code> \u6570\u7ec4<\/td>\n<td>\u65b9\u4fbf\u5faa\u73af\u6279\u5904\u7406<\/td>\n<\/tr>\n<tr>\n<td><code>.map(fn)<\/code><\/td>\n<td>\u6620\u5c04\u6570\u7ec4<\/td>\n<td>\u6279\u91cf\u8f6c\u6362\u8f93\u51fa<\/td>\n<\/tr>\n<tr>\n<td><code>.sort()<\/code><\/td>\n<td>\u6392\u5e8f\u6570\u7ec4<\/td>\n<td>\u7a33\u5b9a\u8f93\u51fa<\/td>\n<\/tr>\n<tr>\n<td><code>JSON.stringify(x, null, 2)<\/code><\/td>\n<td>\u8f6c\u6f02\u4eae JSON<\/td>\n<td>\u9002\u5408\u505a\u63a2\u9488\u56de\u663e<\/td>\n<\/tr>\n<tr>\n<td><code>try { ... } catch (e) { ... }<\/code><\/td>\n<td>\u6355\u83b7\u5f02\u5e38<\/td>\n<td>\u8c03\u672a\u77e5\u51fd\u6570\u5fc5\u5907<\/td>\n<\/tr>\n<tr>\n<td><code>String(e)<\/code><\/td>\n<td>\u628a\u9519\u8bef\u8f6c\u5b57\u7b26\u4e32<\/td>\n<td>\u7a33\u5b9a\u8f93\u51fa\u5f02\u5e38<\/td>\n<\/tr>\n<tr>\n<td><code>obj                                |                      | {}<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>out[name] = value<\/code><\/td>\n<td>\u52a8\u6001\u8bbe\u7f6e\u5c5e\u6027<\/td>\n<td>\u53d8\u91cf\u5f53\u952e\u540d\u65f6\u5fc5\u987b\u7528<\/td>\n<\/tr>\n<tr>\n<td><code>new TextEncoder().encode(s)<\/code><\/td>\n<td>\u6587\u672c\u8f6c\u5b57\u8282<\/td>\n<td>\u5bf9\u63a5\u5e95\u5c42 binary API<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>JavaScript \u57fa\u7840\u8bed\u6cd5 1. \u53d8\u91cf\u58f0\u660e \/\/ const &#8211; \u5e38\u91cf\uff08\u4e0d\u80fd\u91cd\u65b0\u8d4b\u503c\uff09 const nam [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,3],"tags":[],"class_list":["post-234","post","type-post","status-publish","format-standard","hentry","category-js","category-3"],"_links":{"self":[{"href":"https:\/\/arknight.wiki\/index.php\/wp-json\/wp\/v2\/posts\/234","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/arknight.wiki\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arknight.wiki\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arknight.wiki\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/arknight.wiki\/index.php\/wp-json\/wp\/v2\/comments?post=234"}],"version-history":[{"count":1,"href":"https:\/\/arknight.wiki\/index.php\/wp-json\/wp\/v2\/posts\/234\/revisions"}],"predecessor-version":[{"id":235,"href":"https:\/\/arknight.wiki\/index.php\/wp-json\/wp\/v2\/posts\/234\/revisions\/235"}],"wp:attachment":[{"href":"https:\/\/arknight.wiki\/index.php\/wp-json\/wp\/v2\/media?parent=234"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arknight.wiki\/index.php\/wp-json\/wp\/v2\/categories?post=234"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arknight.wiki\/index.php\/wp-json\/wp\/v2\/tags?post=234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}