{"id":52237,"date":"2024-12-03T17:00:49","date_gmt":"2024-12-03T09:00:49","guid":{"rendered":"https:\/\/fwq.ai\/blog\/52237\/"},"modified":"2024-12-03T17:00:49","modified_gmt":"2024-12-03T09:00:49","slug":"%e6%8e%8c%e6%8f%a1-javascript-%e8%bf%90%e7%ae%97%e7%ac%a6%ef%bc%9a%e4%bb%8e%e5%9f%ba%e7%a1%80%e7%9f%a5%e8%af%86%e5%88%b0%e6%8c%89%e4%bd%8d","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/52237\/","title":{"rendered":"\u638c\u63e1 JavaScript \u8fd0\u7b97\u7b26\uff1a\u4ece\u57fa\u7840\u77e5\u8bc6\u5230\u6309\u4f4d"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u638c\u63e1 JavaScript \u8fd0\u7b97\u7b26\uff1a\u4ece\u57fa\u7840\u77e5\u8bc6\u5230\u6309\u4f4d<\/h1>\n<p><span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span>    <\/p>\n<p><span style=\"font-size: 15px\">\u6709\u5fd7\u8005\uff0c\u4e8b\u7adf\u6210\uff01\u5982\u679c\u4f60\u5728\u5b66\u4e60<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\uff0c\u90a3\u4e48\u672c\u6587<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300a\u638c\u63e1 JavaScript \u8fd0\u7b97\u7b26\uff1a\u4ece\u57fa\u7840\u77e5\u8bc6\u5230\u6309\u4f4d\u300b<\/span>\uff0c\u5c31\u5f88\u9002\u5408\u4f60\uff01\u6587\u7ae0\u8bb2\u89e3\u7684\u77e5\u8bc6\u70b9\u4e3b\u8981\u5305\u62ec<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\uff0c\u82e5\u662f\u4f60\u5bf9\u672c\u6587\u611f\u5174\u8da3\uff0c\u6216\u8005\u662f\u60f3\u641e\u61c2\u5176\u4e2d\u67d0\u4e2a\u77e5\u8bc6\u70b9\uff0c\u5c31\u8bf7\u4f60\u7ee7\u7eed\u5f80\u4e0b\u770b\u5427~<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241119\/1732012601673c6a392e28e.jpg\" class=\"aligncenter\" title=\"\u638c\u63e1 JavaScript \u8fd0\u7b97\u7b26\uff1a\u4ece\u57fa\u7840\u77e5\u8bc6\u5230\u6309\u4f4d\u63d2\u56fe\" alt=\"\u638c\u63e1 JavaScript \u8fd0\u7b97\u7b26\uff1a\u4ece\u57fa\u7840\u77e5\u8bc6\u5230\u6309\u4f4d\u63d2\u56fe\" \/><\/p>\n<p>\u5728\u672c\u535a\u5ba2\u4e2d\uff0c\u6211\u4eec\u5c06\u6df1\u5165\u63a2\u8ba8 javascript \u8fd0\u7b97\u7b26\u7684\u4e16\u754c\uff0c\u6db5\u76d6\u4ece\u57fa\u672c\u7b97\u672f\u5230\u6309\u4f4d\u8fd0\u7b97\u7684\u6240\u6709\u5185\u5bb9\u3002\u6211\u4eec\u5c06\u63a2\u8ba8\u201c\u4e00\u5143\u201d\u3001\u201c\u4e8c\u5143\u201d\u548c\u201c\u64cd\u4f5c\u6570\u201d\u7b49\u672f\u8bed\uff0c\u5e76\u63d0\u4f9b\u5b9e\u9645\u793a\u4f8b\u6765\u5e2e\u52a9\u60a8\u7406\u89e3\u6bcf\u4e2a\u6982\u5ff5\u3002\u8ba9\u6211\u4eec\u5f00\u59cb\u5427\uff01<\/p>\n<h3> <strong>\u57fa\u672c\u8fd0\u7b97\u7b26<\/strong> <\/h3>\n<p><strong>\u4e00\u5143\u3001\u4e8c\u5143\u548c\u64cd\u4f5c\u6570<\/strong><\/p>\n<ul>\n<li> <strong>\u4e00\u5143\u8fd0\u7b97\u7b26<\/strong>&nbsp;\u4f5c\u7528\u4e8e\u5355\u4e2a\u64cd\u4f5c\u6570\uff08\u4f8b\u5982\uff0c<strong>x<\/strong>\uff09\u3002<\/li>\n<li> <strong>\u4e8c\u5143\u8fd0\u7b97\u7b26<\/strong>&nbsp;\u4f5c\u7528\u4e8e\u4e24\u4e2a\u64cd\u4f5c\u6570\uff08\u4f8b\u5982\uff0c<strong>x + y<\/strong>\uff09\u3002<\/li>\n<li> <strong>\u64cd\u4f5c\u6570<\/strong>&nbsp;\u662f\u8fd0\u7b97\u7b26\u6240\u4f5c\u7528\u7684\u503c\u3002<\/li>\n<\/ul>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre>let x = 5;\nlet y = 3;\n\n\/\/ unary operator\nlet negx = -x; \/\/ -5\n\n\/\/ binary operator\nlet sum = x + y; \/\/ 8\n\n<\/pre>\n<h3> <strong>\u6570\u5b66<\/strong> <\/h3>\n<p>javascript \u63d0\u4f9b\u4e86\u591a\u79cd\u6570\u5b66\u8fd0\u7b97\u7b26\u6765\u6267\u884c\u7b97\u672f\u8fd0\u7b97\u3002<\/p>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<p> 837186\u200b\u200b164954 <\/p>\n<h3> <strong>\u4f7f\u7528\u4e8c\u8fdb\u5236 + \u8fdb\u884c\u5b57\u7b26\u4e32\u8fde\u63a5<\/strong> <\/h3>\n<p><strong>+<\/strong> \u8fd0\u7b97\u7b26\u4e5f\u53ef\u7528\u4e8e\u8fde\u63a5\u5b57\u7b26\u4e32\u3002<\/p>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre>let firstname = \"john\";\nlet lastname = \"doe\";\n\nlet fullname = firstname + \" \" + lastname; \/\/ \"john doe\"\n\n<\/pre>\n<h3> <strong>\u6570\u5b57\u8f6c\u6362\uff0c\u4e00\u5143+<\/strong> <\/h3>\n<p>\u4e00\u5143<strong>+<\/strong>\u8fd0\u7b97\u7b26\u53ef\u4ee5\u5c06\u503c\u8f6c\u6362\u4e3a\u6570\u5b57\u3002<\/p>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre>let str = \"123\";\nlet num = +str; \/\/ 123\n\nconsole.log(typeof num); \/\/ \"number\"\n\n<\/pre>\n<h3> <strong>\u8fd0\u7b97\u7b26\u4f18\u5148\u7ea7<\/strong> <\/h3>\n<p>\u8fd0\u7b97\u7b26\u4f18\u5148\u7ea7\u51b3\u5b9a\u8fd0\u7b97\u7684\u6267\u884c\u987a\u5e8f\u3002<\/p>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre>let result = 2 + 3 * 4; \/\/ 14 (multiplication has higher precedence than addition)\n\n<\/pre>\n<h3> <strong>\u4f5c\u4e1a<\/strong> <\/h3>\n<p>\u8d4b\u503c\u8fd0\u7b97\u7b26<strong>=<\/strong>\u7528\u4e8e\u7ed9\u53d8\u91cf\u8d4b\u503c\u3002<\/p>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre>let x = 10;\nlet y = 5;\n\nx = y; \/\/ x is now 5\n\n<\/pre>\n<h3> <strong>\u5c31\u5730\u4fee\u6539<\/strong> <\/h3>\n<p>\u5c31\u5730\u4fee\u6539\u8fd0\u7b97\u7b26\u5c06\u8d4b\u503c\u4e0e\u53e6\u4e00\u4e2a\u64cd\u4f5c\u7ed3\u5408\u8d77\u6765\u3002<\/p>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre>let x = 10;\n\nx += 5; \/\/ x is now 15\nx -= 3; \/\/ x is now 12\nx *= 2; \/\/ x is now 24\nx \/= 4; \/\/ x is now 6\nx %= 5; \/\/ x is now 1\n\n<\/pre>\n<h3> <strong>\u589e\u52a0\/\u51cf\u5c11<\/strong> <\/h3>\n<p>\u9012\u589e (<strong>++<\/strong>) \u548c\u9012\u51cf (<strong>&#8212;<\/strong>) \u8fd0\u7b97\u7b26\u5c06\u503c\u589e\u52a0\u6216\u51cf\u5c11 1\u3002<\/p>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre>let x = 5;\n\nx++; \/\/ x is now 6\nx--; \/\/ x is now 5\n\n<\/pre>\n<h3> <strong>\u6309\u4f4d\u8fd0\u7b97\u7b26<\/strong> <\/h3>\n<p>\u4f4d\u8fd0\u7b97\u7b26\u5bf9\u6570\u5b57\u7684\u4e8c\u8fdb\u5236\u8868\u793a\u5f62\u5f0f\u6267\u884c\u8fd0\u7b97\u3002<\/p>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre>let a = 5; \/\/ 0101 in binary\nlet b = 3; \/\/ 0011 in binary\n\nlet andresult = a &amp; b; \/\/ 0001 in binary, which is 1\nlet orresult = a | b; \/\/ 0111 in binary, which is 7\nlet xorresult = a ^ b; \/\/ 0110 in binary, which is 6\nlet notresult = ~a; \/\/ -6 (two's complement of 0101)\nlet leftshift = a &lt;&lt; 1; \/\/ 1010 in binary, which is 10\nlet rightshift = a &gt;&gt; 1; \/\/ 0010 in binary, which is 2\n\n<\/pre>\n<h3> <strong>\u9017\u53f7<\/strong> <\/h3>\n<p>\u9017\u53f7\u8fd0\u7b97\u7b26 <strong>,<\/strong> \u8ba1\u7b97\u5176\u4e24\u4e2a\u64cd\u4f5c\u6570\u5e76\u8fd4\u56de\u7b2c\u4e8c\u4e2a\u64cd\u4f5c\u6570\u7684\u503c\u3002<\/p>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre>let x = (5, 10); \/\/ x is 10\n\n<\/pre>\n<h3> <strong>\u7ed3\u8bba<\/strong> <\/h3>\n<p>\u7406\u89e3 javascript \u8fd0\u7b97\u7b26\u5bf9\u4e8e\u7f16\u5199\u9ad8\u6548\u4e14\u6709\u6548\u7684\u4ee3\u7801\u81f3\u5173\u91cd\u8981\u3002\u4ece\u57fa\u672c\u7b97\u672f\u5230\u6309\u4f4d\u8fd0\u7b97\uff0c\u6bcf\u4e2a\u8fd0\u7b97\u7b26\u90fd\u6709\u5176\u72ec\u7279\u7684\u7528\u4f8b\u3002\u901a\u8fc7\u638c\u63e1\u8fd9\u4e9b\u8fd0\u7b97\u7b26\uff0c\u60a8\u5c06\u987a\u5229\u6210\u4e3a\u4e00\u540d\u719f\u7ec3\u7684 javascript \u5f00\u53d1\u4eba\u5458\u3002<\/p>\n<p>\u8bf7\u7ee7\u7eed\u5173\u6ce8\u6709\u5173 javascript \u7684\u66f4\u591a\u6df1\u5165\u535a\u5ba2\uff01\u5feb\u4e50\u7f16\u7801\uff01<\/p>\n<p>\u7ec8\u4e8e\u4ecb\u7ecd\u5b8c\u5566\uff01\u5c0f\u4f19\u4f34\u4eec\uff0c\u8fd9\u7bc7\u5173\u4e8e\u300a\u638c\u63e1 JavaScript \u8fd0\u7b97\u7b26\uff1a\u4ece\u57fa\u7840\u77e5\u8bc6\u5230\u6309\u4f4d\u300b\u7684\u4ecb\u7ecd\u5e94\u8be5\u8ba9\u4f60\u6536\u83b7\u591a\u591a\u4e86\u5427\uff01\u6b22\u8fce\u5927\u5bb6\u6536\u85cf\u6216\u5206\u4eab\u7ed9\u66f4\u591a\u9700\u8981\u5b66\u4e60\u7684\u670b\u53cb\u5427~\u7c73\u4e91\u516c\u4f17\u53f7\u4e5f\u4f1a\u53d1\u5e03\u6587\u7ae0\u76f8\u5173\u77e5\u8bc6\uff0c\u5feb\u6765\u5173\u6ce8\u5427\uff01<\/p>\n<p>      \u7248\u672c\u58f0\u660e \u672c\u6587\u8f6c\u8f7d\u4e8e\uff1adev.to \u5982\u6709\u4fb5\u72af\uff0c\u8bf7\u8054\u7cfb\u5220\u9664    <\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   \u8f7b\u677e\u8fde\u63a5\uff1a\u8be6\u7ec6\u6307\u5357\u6559\u4f60\u5982\u4f55\u5c06\u7535\u8111\u8fde\u63a5\u5230\u8def\u7531\u5668\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u638c\u63e1 JavaScript \u8fd0\u7b97\u7b26\uff1a\u4ece\u57fa\u7840\u77e5\u8bc6\u5230\u6309\u4f4d \u6536\u85cf \u6709\u5fd7\u8005\uff0c\u4e8b\u7adf\u6210\uff01\u5982\u679c\u4f60\u5728\u5b66\u4e60\u6587\u7ae0\uff0c\u90a3\u4e48\u672c\u6587\u300a\u638c\u63e1 JavaScript \u8fd0\u7b97\u7b26\uff1a\u4ece\u57fa\u7840\u77e5\u8bc6\u5230\u6309\u4f4d\u300b\uff0c\u5c31\u5f88\u9002\u5408\u4f60\uff01\u6587\u7ae0\u8bb2\u89e3\u7684\u77e5\u8bc6\u70b9\u4e3b\u8981\u5305\u62ec\uff0c\u82e5\u662f\u4f60\u5bf9\u672c\u6587\u611f\u5174\u8da3\uff0c\u6216\u8005\u662f\u60f3\u641e\u61c2\u5176\u4e2d\u67d0\u4e2a\u77e5\u8bc6\u70b9\uff0c\u5c31\u8bf7\u4f60\u7ee7\u7eed\u5f80\u4e0b\u770b\u5427~ \u5728\u672c\u535a\u5ba2\u4e2d\uff0c\u6211\u4eec\u5c06\u6df1\u5165\u63a2\u8ba8 javascript \u8fd0\u7b97\u7b26\u7684\u4e16\u754c\uff0c\u6db5\u76d6\u4ece\u57fa\u672c\u7b97\u672f\u5230\u6309\u4f4d\u8fd0\u7b97\u7684\u6240\u6709\u5185\u5bb9\u3002\u6211\u4eec\u5c06\u63a2\u8ba8\u201c\u4e00\u5143\u201d\u3001\u201c\u4e8c\u5143\u201d\u548c\u201c\u64cd\u4f5c\u6570\u201d\u7b49\u672f\u8bed\uff0c\u5e76\u63d0\u4f9b\u5b9e\u9645\u793a\u4f8b\u6765\u5e2e\u52a9\u60a8\u7406\u89e3\u6bcf\u4e2a\u6982\u5ff5\u3002\u8ba9\u6211\u4eec\u5f00\u59cb\u5427\uff01 \u57fa\u672c\u8fd0\u7b97\u7b26 \u4e00\u5143\u3001\u4e8c\u5143\u548c\u64cd\u4f5c\u6570 \u4e00\u5143\u8fd0\u7b97\u7b26&nbsp;\u4f5c\u7528\u4e8e\u5355\u4e2a\u64cd\u4f5c\u6570\uff08\u4f8b\u5982\uff0cx\uff09\u3002 \u4e8c\u5143\u8fd0\u7b97\u7b26&nbsp;\u4f5c\u7528\u4e8e\u4e24\u4e2a\u64cd\u4f5c\u6570\uff08\u4f8b\u5982\uff0cx + y\uff09\u3002 \u64cd\u4f5c\u6570&nbsp;\u662f\u8fd0\u7b97\u7b26\u6240\u4f5c\u7528\u7684\u503c\u3002 \u793a\u4f8b\uff1a let x = 5; let y = 3; \/\/ unary operator let negx = -x; \/\/ -5 \/\/ binary operator let sum = x + y; \/\/ 8 \u6570\u5b66 javascript \u63d0\u4f9b\u4e86\u591a\u79cd\u6570\u5b66\u8fd0\u7b97\u7b26\u6765\u6267\u884c\u7b97\u672f\u8fd0\u7b97\u3002 \u793a\u4f8b\uff1a 837186\u200b\u200b164954 \u4f7f\u7528\u4e8c\u8fdb\u5236 + \u8fdb\u884c\u5b57\u7b26\u4e32\u8fde\u63a5 + [&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-52237","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52237","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=52237"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52237\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=52237"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=52237"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=52237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}