{"id":21611,"date":"2024-11-19T08:54:25","date_gmt":"2024-11-19T00:54:25","guid":{"rendered":"https:\/\/fwq.ai\/blog\/21611\/"},"modified":"2024-11-19T08:54:25","modified_gmt":"2024-11-19T00:54:25","slug":"vscode%e5%a6%82%e4%bd%95%e8%bf%90%e8%a1%8cjs%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/21611\/","title":{"rendered":"vscode\u5982\u4f55\u8fd0\u884cjs\u4ee3\u7801"},"content":{"rendered":"<blockquote><p>\n  \u5982\u4f55\u5728 vscode \u4e2d\u8fd0\u884c js \u4ee3\u7801\uff1f\u521b\u5efa.js\u6587\u4ef6\u5e76\u7f16\u5199\u4ee3\u7801\uff1b\u5b89\u88c5 node.js \u548c npm\uff1b\u5b89\u88c5debugger for chrome\uff1b\u6253\u5f00\u8c03\u8bd5\u63a7\u5236\u53f0\uff1b\u9009\u62e9chrome\uff1b\u6dfb\u52a0\u8c03\u8bd5\u914d\u7f6e\uff1b\u8bbe\u7f6e\u8c03\u8bd5\u811a\u672c\uff1b\u8fd0\u884c\u4ee3\u7801\uff1b\u8c03\u8bd5\u4ee3\u7801\uff08\u53ef\u9009\uff09\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/07\/2024060707062127754.jpg\" class=\"aligncenter\" title=\"vscode\u5982\u4f55\u8fd0\u884cjs\u4ee3\u7801\u63d2\u56fe\" alt=\"vscode\u5982\u4f55\u8fd0\u884cjs\u4ee3\u7801\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728 Visual Studio Code \u4e2d\u8fd0\u884c JS \u4ee3\u7801<\/strong><\/p>\n<p>Visual Studio Code\uff08\u7b80\u79f0 VSCode\uff09\u662f\u4e00\u79cd\u6d41\u884c\u7684\u4ee3\u7801\u7f16\u8f91\u5668\uff0c\u5b83\u652f\u6301\u8fd0\u884c JavaScript \u4ee3\u7801\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u5728 VSCode \u4e2d\u8fd0\u884c JS \u4ee3\u7801\uff1a<\/p>\n<p><strong>1. \u521b\u5efa\u4e00\u4e2a JavaScript \u6587\u4ef6<\/strong><\/p>\n<p>\u5728 VSCode \u4e2d\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u6587\u4ef6\u5e76\u5c06\u5176\u6269\u5c55\u540d\u8bbe\u7f6e\u4e3a &#8220;.js&#8221;\u3002\u4f8b\u5982\uff1a\u201cexample.js\u201d\u3002<\/p>\n<p><strong>2. \u7f16\u5199 JS \u4ee3\u7801<\/strong><\/p>\n<p>\u5728\u6587\u4ef6\u4e2d\u7f16\u5199\u4f60\u7684 JavaScript \u4ee3\u7801\u3002\u4f8b\u5982\uff1a<\/p>\n<pre>console.log(\"Hello, world!\");<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u5b89\u88c5 Node.js \u548c npm<\/strong><\/p>\n<p>\u8981\u8fd0\u884c JS \u4ee3\u7801\uff0c\u4f60\u9700\u8981\u5728\u4f60\u7684\u7cfb\u7edf\u4e2d\u5b89\u88c5 Node.js \u548c npm\u3002\u8fd9\u4e9b\u5de5\u5177\u53ef\u4ee5\u4ece Node.js \u7f51\u7ad9\u4e0b\u8f7d\u3002<\/p>\n<p><strong>4. \u5b89\u88c5 Debugger for Chrome<\/strong><\/p>\n<p>\u4e3a\u4e86\u5728 VSCode \u4e2d\u8c03\u8bd5 JS \u4ee3\u7801\uff0c\u4f60\u9700\u8981\u5b89\u88c5 Debugger for Chrome \u6269\u5c55\u3002<\/p>\n<p><strong>5. \u6253\u5f00\u8c03\u8bd5\u63a7\u5236\u53f0<\/strong><\/p>\n<p>\u5728 VSCode \u4e2d\uff0c\u6253\u5f00 &#8220;\u8c03\u8bd5&#8221; \u63a7\u5236\u53f0\uff08\u6216\u4f7f\u7528\u5feb\u6377\u952e Ctrl + Shift + D\uff09\u3002<\/p>\n<p><strong>6. \u9009\u62e9 Chrome<\/strong><\/p>\n<p>\u5728 &#8220;\u9009\u62e9\u73af\u5883&#8221; \u4e0b\u62c9\u83dc\u5355\u4e2d\uff0c\u9009\u62e9 &#8220;Chrome&#8221; \u4f5c\u4e3a\u4f60\u7684\u8c03\u8bd5\u5668\u3002<\/p>\n<p><strong>7. \u6dfb\u52a0\u4e00\u4e2a\u8c03\u8bd5\u914d\u7f6e<\/strong><\/p>\n<p>\u70b9\u51fb &#8220;\u6dfb\u52a0\u914d\u7f6e&#8221; \u6309\u94ae\u5e76\u9009\u62e9 &#8220;JavaScript&#8221;\u3002\u4e3a\u8c03\u8bd5\u914d\u7f6e\u6307\u5b9a\u4e00\u4e2a\u540d\u79f0\uff0c\u4f8b\u5982 &#8220;Launch JavaScript&#8221;\u3002<\/p>\n<p><strong>8. \u8bbe\u7f6e\u8c03\u8bd5\u811a\u672c<\/strong><\/p>\n<p>\u5728 &#8220;\u542f\u52a8\u811a\u672c&#8221; \u90e8\u5206\uff0c\u6307\u5b9a\u8981\u8fd0\u884c\u7684 JS \u6587\u4ef6\u7684\u8def\u5f84\u3002\u4f8b\u5982\uff1a<\/p>\n<pre>{\n  \"type\": \"node\",\n  \"request\": \"launch\",\n  \"name\": \"Launch JavaScript\",\n  \"program\": \"${workspaceFolder}\/example.js\"\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>9. \u8fd0\u884c\u4ee3\u7801<\/strong><\/p>\n<p>\u5355\u51fb &#8220;\u8fd0\u884c&#8221; \u6309\u94ae\u6216\u4f7f\u7528\u5feb\u6377\u952e F5 \u8fd0\u884c\u4f60\u7684 JS \u4ee3\u7801\u3002<\/p>\n<p><strong>10. \u8c03\u8bd5\u4ee3\u7801\uff08\u53ef\u9009\uff09<\/strong><\/p>\n<p>\u5982\u679c\u4f60\u5b89\u88c5\u4e86 Debugger for Chrome \u6269\u5c55\uff0c\u4f60\u53ef\u4ee5\u5728\u8c03\u8bd5\u63a7\u5236\u53f0\u4e2d\u8bbe\u7f6e\u65ad\u70b9\u548c\u9010\u6b65\u8c03\u8bd5\u4f60\u7684\u4ee3\u7801\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u8fd0\u884cjs\u4ee3\u7801\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>\u5982\u4f55\u5728 vscode \u4e2d\u8fd0\u884c js \u4ee3\u7801\uff1f\u521b\u5efa.js\u6587\u4ef6\u5e76\u7f16\u5199\u4ee3\u7801\uff1b\u5b89\u88c5 node.js \u548c npm\uff1b\u5b89\u88c5debugger for chrome\uff1b\u6253\u5f00\u8c03\u8bd5\u63a7\u5236\u53f0\uff1b\u9009\u62e9chrome\uff1b\u6dfb\u52a0\u8c03\u8bd5\u914d\u7f6e\uff1b\u8bbe\u7f6e\u8c03\u8bd5\u811a\u672c\uff1b\u8fd0\u884c\u4ee3\u7801\uff1b\u8c03\u8bd5\u4ee3\u7801\uff08\u53ef\u9009\uff09\u3002 \u5982\u4f55\u5728 Visual Studio Code \u4e2d\u8fd0\u884c JS \u4ee3\u7801 Visual Studio Code\uff08\u7b80\u79f0 VSCode\uff09\u662f\u4e00\u79cd\u6d41\u884c\u7684\u4ee3\u7801\u7f16\u8f91\u5668\uff0c\u5b83\u652f\u6301\u8fd0\u884c JavaScript \u4ee3\u7801\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u5728 VSCode \u4e2d\u8fd0\u884c JS \u4ee3\u7801\uff1a 1. \u521b\u5efa\u4e00\u4e2a JavaScript \u6587\u4ef6 \u5728 VSCode \u4e2d\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u6587\u4ef6\u5e76\u5c06\u5176\u6269\u5c55\u540d\u8bbe\u7f6e\u4e3a &#8220;.js&#8221;\u3002\u4f8b\u5982\uff1a\u201cexample.js\u201d\u3002 2. \u7f16\u5199 JS \u4ee3\u7801 \u5728\u6587\u4ef6\u4e2d\u7f16\u5199\u4f60\u7684 JavaScript \u4ee3\u7801\u3002\u4f8b\u5982\uff1a console.log(&#8220;Hello, world!&#8221;); \u767b\u5f55\u540e\u590d\u5236 3. \u5b89\u88c5 Node.js \u548c npm \u8981\u8fd0\u884c JS \u4ee3\u7801\uff0c\u4f60\u9700\u8981\u5728\u4f60\u7684\u7cfb\u7edf\u4e2d\u5b89\u88c5 Node.js \u548c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-21611","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21611","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=21611"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21611\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=21611"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=21611"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=21611"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}