{"id":6070,"date":"2020-04-30T19:22:42","date_gmt":"2020-04-30T11:22:42","guid":{"rendered":"https:\/\/www.lilichao.com\/?p=6070"},"modified":"2022-05-14T19:25:16","modified_gmt":"2022-05-14T11:25:16","slug":"%e8%bf%90%e7%ae%97%e7%ac%a6%ef%bc%88operators%ef%bc%89","status":"publish","type":"post","link":"https:\/\/lilichao.com\/?p=6070","title":{"rendered":"\u8fd0\u7b97\u7b26\uff08operators\uff09"},"content":{"rendered":"\n<p>\u8fd0\u7b97\u7b26\u7528\u6765\u5bf9\u4e00\u4e2a\u503c\u6216\u591a\u4e2a\u503c\u8fdb\u884c\u8fd0\u7b97\u6216\u64cd\u4f5c\uff0c\u6240\u4ee5\u8fd0\u7b97\u7b26\u4e5f\u88ab\u7ffb\u8bd1\u4e3a\u64cd\u4f5c\u7b26\u3002\u4f8b\u5982\uff1a+\uff08\u52a0\u53f7\uff09\u7528\u6765\u5bf9\u4e24\u4e2a\u503c\u8fdb\u884c\u52a0\u6cd5\u8fd0\u7b97\u5e76\u5c06\u7ed3\u679c\u8fd4\u56de\u3002JS\u4e2d\u5305\u542b\u6709\u975e\u5e38\u975e\u5e38\u591a\u7684\u8fd0\u7b97\u7b26\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u7b97\u672f\u8fd0\u7b97\u7b26\uff08 Arithmetic operators\uff09<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>\u7b26\u53f7<\/td><td>\u4f5c\u7528<\/td><td>\u793a\u4f8b<\/td><\/tr><tr><td>+<\/td><td>\u7528\u4e8e\u5bf9\u4e24\u4e2a\u503c\u8fdb\u884c\u52a0\u6cd5\u8fd0\u7b97<\/td><td><code>1 + 2 \/\/ \u7ed3\u679c3<\/code><\/td><\/tr><tr><td>&#8211;<\/td><td>\u7528\u4e8e\u5bf9\u4e24\u4e2a\u503c\u8fdb\u884c\u51cf\u6cd5\u8fd0\u7b97<\/td><td><code>3 - 1 \/\/ \u7ed3\u679c2<\/code><\/td><\/tr><tr><td>*<\/td><td>\u7528\u4e8e\u5bf9\u4e24\u4e2a\u503c\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97<\/td><td><code>3 * 2 \/\/ \u7ed3\u679c6<\/code><\/td><\/tr><tr><td>\/<\/td><td>\u7528\u4e8e\u5bf9\u4e24\u4e2a\u503c\u8fdb\u884c\u9664\u6cd5\u8fd0\u7b97<\/td><td><code>6 \/ 2 \/\/ \u7ed3\u679c3<\/code><\/td><\/tr><tr><td>%<\/td><td>\u7528\u4e8e\u5bf9\u4e24\u4e2a\u503c\u8fdb\u884c\u53d6\u4f59\u8fd0\u7b97<\/td><td><code>9 % 4 \/\/ \u7ed3\u679c1<\/code><\/td><\/tr><tr><td>**<\/td><td>\u7528\u4e8e\u5bf9\u4e24\u4e2a\u503c\u8fdb\u884c\u5e42\u8fd0\u7b97<\/td><td><code>2 ** 3 \/\/ \u7ed3\u679c8<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u52a0\u51cf\u4e58\u9664\u56db\u5219\u8fd0\u7b97\u6211\u4eec\u5df2\u7ecf\u975e\u5e38\u719f\u6089\u4e86\uff0c\u9664\u6b64\u4e4b\u5916JS\u4e2d\u8fd8\u63d0\u4f9b\u4e86%\uff08\u4e24\u4e2a\u6570\u76f8\u9664\u53d6\u4f59\u6570\uff09\uff0c**\uff08\u6c42\u67d0\u4e2a\u6570\u7684\u51e0\u6b21\u5e42\uff09\u3002\u5982\u679c\u662f\u5355\u7eaf\u7684\u8fd0\u7b97\u5e94\u8be5\u662f\u6ca1\u6709\u4ec0\u4e48\u592a\u5927\u7684\u95ee\u9898\uff0c\u4f46\u8fd9\u91cc\u8fd8\u662f\u8981\u5f3a\u8c03\u4e00\u4e0b\u9700\u8981\u6ce8\u610f\u7684\u5730\u65b9\u3002<\/p>\n\n\n\n<p>\u9996\u5148\u8fd9\u4e9b\u4e2a\u7b97\u6570\u8fd0\u7b97\u7b26\u90fd\u4e0d\u4f1a\u53d8\u91cf\u4ea7\u751f\u4efb\u4f55\u5f71\u54cd\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>let a = 10\nlet b = 20\na + b \/\/ \u4e0d\u4f1a\u5bf9a\u548cb\u4ea7\u751f\u4efb\u4f55\u5f71\u54cd<\/code><\/pre>\n\n\n\n<p>\u4e0a\u8fb9\u6848\u4f8b\u4e2d\uff0c\u4e24\u4e2a\u53d8\u91cfa\u548cb\uff0c\u5bf9\u4e24\u4e2a\u53d8\u91cf\u8fdb\u884c\u52a0\u6cd5\u8fd0\u7b97\u540e\uff0c\u4e0d\u4f1a\u5bf9a\u548cb\u4ea7\u751f\u5f71\u54cd\u3002\u7b97\u6570\u9884\u7b97\u7b26\u7684\u4f5c\u7528\u4ec5\u4ec5\u662f\u5bf9\u4e24\u4e2a\u503c\u8fdb\u884c\u7b97\u6570\u8fd0\u7b97\uff0c\u7136\u540e\u8fd4\u56de\u7ed3\u679c\u3002\u8981\u60f3\u5f97\u5230\u5c31\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u53d8\u91cf\u7528\u6765\u5b58\u50a8\u8fd0\u7b97\u7ed3\u679c\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>let a = 10\nlet b = 20\nlet c = a + b \/\/ \u5c06a+b\u7684\u7ed3\u679c\u8d4b\u503c\u7ed9c\uff0c\u540c\u6837\u4e0d\u4f1a\u5f71\u54cda\u548cb<\/code><\/pre>\n\n\n\n<p>\u9664\u6b64\u4e4b\u5916\u4e5f\u53ef\u4ee5\u8fd9\u6837\u5199<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>let a = 10\na = a + 20 \/\/ \u5c06a+10\u7684\u7ed3\u679c\u8d4b\u503c\u7ed9a<\/code><\/pre>\n\n\n\n<p>\u8fd9\u6837\u5199\u7684\u610f\u601d\u8868\u793a\u5c06a+20\u7684\u7ed3\u679c\u5728\u8d4b\u503c\u7ed9a\uff0c\u8fd9\u6837a\u7684\u503c\u6700\u7ec8\u5c06\u4f1a\u53d8\u621030\u3002\u7b2c\u4e00\u6b21\u63a5\u89e6\u8bed\u8a00\u7684\u540c\u5b66\u53ef\u80fd\u4f1a\u89c9\u5f97\u8fd9\u79cd\u5199\u6cd5\u6bd4\u8f83\u5947\u602a\uff0c\u5947\u602a\u4e5f\u6ca1\u6709\u529e\u6cd5\uff0c\u5c31\u662f\u53ef\u4ee5\u8fd9\u4e48\u5199\u3002\u8981\u7406\u89e3\u8fd9\u4e2a\u5148\u8981\u660e\u786e\u4e00\u70b9\uff0c\u53d8\u91cf\u5728\u7b49\u53f7\u5de6\u8fb9\u548c\u53f3\u8fb9\u6240\u4ee3\u8868\u7684\u610f\u4e49\u662f\u4e0d\u540c\u7684\uff0c\u53d8\u91cf\u5728\u7b49\u53f7\u5de6\u8fb9\u65f6\u8868\u793a\u53d8\u91cf\uff0c\u5728\u53f3\u8fb9\u65f6\u8868\u793a\u7684\u662f\u5b83\u6240\u4ee3\u8868\u7684\u503c\u3002\u4e0a\u4f8b\u4e2d\u7b49\u53f7\u5de6\u4fa7\u7684\uff08a =\uff09\u6b64\u65f6\u7684a\u6ca1\u4ec0\u4e48\u597d\u8bf4\u7684\u5c31\u662f\u4e00\u4e2a\u53d8\u91cf\u3002\u53f3\u8fb9\u7684a\uff08=  a + 20\uff09\u6b64\u65f6a\u8868\u793a\u7684\u662f\u5b83\u6240\u4ee3\u8868\u7684\u503c\u4e5f\uff0c\u4e5f\u5c31\u662f10\uff0c\u6240\u4ee5 = a + 20\u5b9e\u9645\u4e0a\u5c31\u76f8\u5f53\u4e8e = 10 + 20\u3002<\/p>\n\n\n\n<p>\u800c\u4e14\u8fdb\u884c\u8d4b\u503c\u7684\u65f6\u5019\uff0c\u7b49\u53f7\u53f3\u8fb9\u662f\u5148\u6267\u884c\u7684\uff0c\u6240\u4ee5a = a + 20\u53ef\u4ee5\u770b\u4f5c\u662fa = 10 + 20\uff0c\u8fd9\u662f\u5b8c\u5168\u7b49\u4ef7\u7684\u3002<\/p>\n\n\n\n<p>\u4e0a\u4e00\u4e2a\u4f8b\u5b50\u4e2d\u5bf9\u53d8\u91cfa\u8fdb\u884c\u4e86\u91cd\u65b0\u8d4b\u503c\uff0c\u6240\u4ee5\u5982\u679c\u8fd9\u4e48\u5199\u5c31\u4f1a\u5bfc\u81f4\u53d8\u91cf\u7684\u6539\u53d8\uff0c\u4f46\u662f\u53d8\u91cf\u6539\u53d8\u4e5f\u548c\u7b97\u672f\u8fd0\u7b97\u7b26\u6ca1\u6709\u4ec0\u4e48\u5173\u7cfb\uff0c\u53d8\u91cf\u6539\u53d8\u662f\u7531\u4e8e\u8d4b\u503c\u8fd0\u7b97\u7b26=\u6240\u5bfc\u81f4\u7684\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5176\u4ed6\u7c7b\u578b\u7684\u503c<\/h3>\n\n\n\n<p>\u7b97\u672f\u8fd0\u7b97\u7b26\u9664\u4e86\u53ef\u4ee5\u5b8c\u6210\u6570\u503c\u95f4\u8fd0\u7b97\u4ee5\u5916\uff0c\u4e5f\u53ef\u4ee5\u5bf9\u5176\u4ed6\u7c7b\u578b\u5bf9\u503c\u8fdb\u884c\u8fd0\u7b97\u3002\u6bd4\u5982\u53ef\u4ee5\u8ba9true\u548cfalse\u8fdb\u884c\u76f8\u52a0\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>true + false \/\/ 1<\/code><\/pre>\n\n\n\n<p>\u5443\uff1ftrue\u548cfalse\u662f\u600e\u4e48\u7b97\u7684\uff1f\u5f88\u7b80\u5355\uff0c\u5728JS\u4e2d\u6709\u81ea\u52a8\u7684\u7c7b\u578b\u8f6c\u6362\u673a\u5236\uff0c\u5f53\u4f60\u5bf9\u975e\u6570\u5b57\u7c7b\u578b\u7684\u503c\u8fdb\u884c\u7b97\u672f\u8fd0\u7b97\u65f6\uff0c\u6d4f\u89c8\u5668\u4f1a\u81ea\u52a8\u5c06\u5176\u8f6c\u6362\u4e3a\u6570\u5b57\u7136\u540e\u518d\u8fdb\u884c\u8fd0\u7b97\u3002true\u548cfalse\u76f8\u52a0\uff0ctrue\u4f1a\u88ab\u8f6c\u6362\u4e3a1\uff0cfalse\u4f1a\u88ab\u8f6c\u6362\u4e3a0\uff0c\u6240\u4ee5true+false\u7ed3\u679c\u4e3a1\u3002\u5176\u5b9etrue\u548cfalse\u5728\u7a0b\u5e8f\u5e95\u5c42\u5c31\u662f\u4ee51\u548c0\u8868\u793a\u7684\uff0ctrue\u5c31\u662f1\uff0cfalse\u5c31\u662f0\u3002<\/p>\n\n\n\n<p>\u90a3\u4e48\uff0c\u5176\u4ed6\u7c7b\u578b\u7684\u503c\u4f1a\u5982\u4f55\u8f6c\u6362\u5462\uff1f\u53ef\u4ee5\u76f4\u63a5\u7ed9\u4e00\u4e2a\u503c\u51cf\uff0c\u7136\u540e\u76f4\u63a5\u67e5\u770b\u7ed3\u679c\u5c31OK\u4e86\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>console.log(`true - 0 = ${true - 0}`)\nconsole.log(`false - 0 = ${false - 0}`)\nconsole.log(`null - 0 = ${null - 0}`)\nconsole.log(`undefined - 0 = ${undefined - 0}`)\nconsole.log(`NaN - 0 = ${NaN - 0}`)\nconsole.log(`Infinity - 0 = ${Infinity - 0}`)<\/code><\/pre>\n\n\n\n<p>\u6267\u884c\u7ed3\u679c\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"239\" height=\"124\" src=\"https:\/\/my-wp.oss-cn-beijing.aliyuncs.com\/wp-content\/uploads\/2022\/05\/20220514192430281.png\" alt=\"\" class=\"wp-image-6072\"\/><figcaption>\u8fd0\u884c\u7ed3\u679c<\/figcaption><\/figure><\/div>\n\n\n\n<p>\u901a\u8fc7\u8fd9\u4e2a\u793a\u4f8b\u7ed3\u679c\u5c31\u6bd4\u8f83\u6e05\u6670\u4e86\uff0ctrue\u8f6c\u6362\u4e3a1\uff0cfalse\u8f6c\u6362\u4e3a0\uff0cnull\u8f6c\u6362\u4e3a0\uff0cundefined\u8f6c\u6362\u4e3aNaN\u3002\u9664\u6b64\u4e4b\u5916\u4e0b\u8fb9\u8fd8\u4e3e\u4e86\u4e24\u4e2a\u4f8b\u5b50NaN\u548cInfinity\uff0c\u4e00\u4e2a\u6570\u5b57\u548cNaN\u4f5c\u7528\u8fd0\u7b97\uff0c\u6700\u7ec8\u7ed3\u679c\u4e3aNaN\u3002\u4e00\u4e2a\u6570\u5b57\u548cInfinity\uff0c\u6700\u7ec8\u7ed3\u679c\u4e3aInfinity\u3002<\/p>\n\n\n\n<p>\u5b57\u7b26\u4e32\u7684\u60c5\u51b5\u6bd4\u8f83\u7279\u6b8a\uff0c\u6211\u4eec\u5355\u72ec\u6765\u8bf4\u4e00\u4e0b<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>console.log(`\"123\" - 0 = ${\"123\" - 0}`)\nconsole.log(`'hello' - 0 = ${'hello' - 0}`)\nconsole.log(`'123px' - 0 = ${'123px' - 0}`) <\/code><\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"176\" height=\"62\" src=\"https:\/\/my-wp.oss-cn-beijing.aliyuncs.com\/wp-content\/uploads\/2022\/05\/20220514192437172.png\" alt=\"\" class=\"wp-image-6073\"\/><figcaption>\u8fd0\u7b97\u7ed3\u679c<\/figcaption><\/figure><\/div>\n\n\n\n<p>\u5bf9\u4e8e\u5b57\u7b26\u4e32\u6765\u8bf4\uff0c\u5982\u679c\u5b57\u7b26\u4e32\u672c\u8eab\u662f\u4e00\u4e2a\u5408\u6cd5\u7684\u6570\u5b57\uff08\u4e0d\u5305\u62ec\u5927\u6574\u6570\uff09&#8221;123&#8243;\u3001&#8221;3.14&#8243;\u4f1a\u76f4\u63a5\u8f6c\u6362\u4e3a\u5bf9\u5e94\u7684\u6570\u5b57\u3002\u5982\u679c\u5b57\u7b26\u4e32\u4e0d\u662f\u4e00\u4e2a\u5408\u6cd5\u7684\u6570\u5b57&#8221;hello&#8221;\u3001&#8221;123px&#8221;\u4f1a\u8f6c\u6362\u4e3aNaN\u3002<\/p>\n\n\n\n<p>\u6700\u540e\u4e00\u79cd\u7279\u6b8a\u60c5\u51b5\u5c31\u662f\u5b57\u7b26\u4e32\u7684\u52a0\u6cd5\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>console.log('hello' + 123) <\/code><em><code>\/\/ \"hello123\"\n<\/code><\/em><code>console.log('hello' + true) <\/code><em><code>\/\/ \"hellotrue\"\n<\/code><\/em><code>console.log('hello' + false) <\/code><em><code>\/\/ \"hellofalse\"\n<\/code><\/em><code>console.log('hello' + null) <\/code><em><code>\/\/ \"hellonull\"\n<\/code><\/em><code>console.log('hello' + undefined) <\/code><em><code>\/\/ \"helloundefined\"<\/code><\/em><\/pre>\n\n\n\n<p>\u4efb\u4f55\u7684\u503c\u548c\u5b57\u7b26\u4e32\u505a\u52a0\u6cd5\u65f6\u90fd\u4f1a\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\uff08123\u53d8&#8217;123&#8217;\u3001true\u53d8&#8217;true&#8217;\u7b49\uff09\uff0c\u7136\u540e\u548c\u5b57\u7b26\u4e32\u8fdb\u884c\u62fc\u63a5\u5b57\u7b26\u4e32\u7684\u64cd\u4f5c\u3002\u4f8b\u5982\uff1a&#8217;hello&#8217; + 123 \u4f1a\u628a123\u8f6c\u6362\u4e3a&#8217;123&#8217;\uff0c\u7136\u540e\u5c06&#8217;hello&#8217;\u548c&#8217;123&#8217;\u62fc\u63a5\u4e3a\u4e00\u4e2a\u5b57\u7b26\u4e32&#8217;hello123&#8217;\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u81ea\u589e\u548c\u81ea\u51cf<\/h2>\n\n\n\n<p>\u548c\u7b97\u672f\u8fd0\u7b97\u7b26\u4e0d\u540c\uff0c\u81ea\u589e\u548c\u81ea\u51cf\u8fd0\u7b97\u7b26\u53ea\u80fd\u7528\u4e8e\u53d8\u91cf\u3002\u81ea\u589e\u8fd0\u7b97\u7b26++\uff0c\u81ea\u51cf\u8fd0\u7b97\u7b26&#8211;\u3002\u5148\u6765\u770b\u81ea\u589e\uff0c\u81ea\u589e\u53ef\u4ee5\u8fd9\u6837\u4f7f\u7528\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>let a = 10\na++\nconsole.log(a) \/\/ \u8f93\u51fa11<\/code><\/pre>\n\n\n\n<p>\u6216<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>let a = 10\n++a\nconsole.log(a) \/\/ \u8f93\u51fa11<\/code><\/pre>\n\n\n\n<p>\u81ea\u589e\u8fd0\u7b97\u7b26\u4f1a\u76f4\u63a5\u4fee\u6539\u53d8\u91cf\u7684\u503c\uff08\u4e0d\u9700\u8981\u8d4b\u503c\uff09\uff0c\u8fd9\u4e00\u70b9\u548c\u7b97\u672f\u8fd0\u7b97\u7b26\u6709\u5f88\u5927\u7684\u533a\u522b\u3002\u6240\u4ee5\u81ea\u589e\u4ee5\u540e\uff0c\u65e0\u8bba++\u5199\u5728\u53d8\u91cf\u7684\u524d\u8fb9\u8fd8\u662f\u540e\u8fb9\uff0c\u53d8\u91cf\u7684a\u7684\u503c\u90fd\u4f1a\u7acb\u5373\u589e\u52a01\u3002\u539f\u6765\u662f1\u53d8\u62102\uff0c\u539f\u6765\u662f2\u53d8\u62103\uff0c\u539f\u6765\u662f10\u53d8\u621011\uff0c\u6240\u4ee5\u4e0a\u4f8b\u4e2d\u4e24\u4e2aa\u6700\u7ec8\u8f93\u51fa\u7684\u503c\u90fd\u662f11\u3002<\/p>\n\n\n\n<p>\u90a3\u4e48\u4e8c\u8005\u6709\u4f55\u533a\u522b\u5462\uff1f\u8fd9\u91cc\u5c31\u8981\u56de\u987e\u6211\u4eec\u4e4b\u524d\u7684\u5185\u5bb9\uff0c\u4e4b\u524d\u6211\u4eec\u63d0\u5230\u8fc7\u4ee3\u7801\u901a\u5e38\u4f1a\u6709\u4e24\u4e2a\u5c42\u9762\uff0c\u4e00\u4e2a\u662f\u5b83\u505a\u7684\u4e8b\u60c5\uff0c\u8fd8\u6709\u4e00\u4e2a\u662f\u5b83\u8fd4\u56de\u7684\u7ed3\u679c\u3002\u8fd9\u91cc\u81ea\u589e\u6240\u505a\u7684\u4e8b\u60c5\u5c31\u662f\u4f7f\u53d8\u91cf\u5728\u5176\u539f\u503c\u7684\u57fa\u7840\u4e0a\u52a01\u3002\u7136\u800c\uff0c\u9664\u4e86\u505a\u4e8b\u60c5\u4ee5\u5916\u81ea\u589e\u4e5f\u4f1a\u8fd4\u56de\u4e00\u4e2a\u7ed3\u679c\uff0c\u6211\u4eec\u53ef\u4ee5\u8fd9\u6837\u63a5\u6536\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>let a = 10\nlet b = ++a <\/code><em><code>\/\/ \u5c06\u8868\u8fbe\u5f0f\u7684\u8fd4\u56de\u503c\u8d4b\u503c\u7ed9b\n<\/code><\/em><code>console.log(`a = ${a}`) \/\/ a = 11 \nconsole.log(`b = ${b}`) \/\/ b = 11<\/code><\/pre>\n\n\n\n<p>\u4e0a\u4f8b\u4e2d\uff0c\u8c03\u7528\u4e86++a\uff0c\u540c\u65f6\u5c06++a\u7684\u8fd4\u56de\u503c\u8d4b\u503c\u7ed9\u4e86b\uff0c\u6253\u5370\u540e\u53d1\u73b0a\u548cb\u7684\u503c\u90fd\u662f11\uff0c\u8fd9\u5c31\u610f\u5473\u7740\uff0c++a\u7684\u8fd4\u56de\u503c\u548c\u53d8\u91cfa\u6700\u7ec8\u7684\u503c\u662f\u4e00\u6837\u7684\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>let a = 10\nlet b = a++ <\/code><em><code>\/\/ \u5c06\u8868\u8fbe\u5f0f\u7684\u8fd4\u56de\u503c\u8d4b\u503c\u7ed9b\n<\/code><\/em><code>console.log(`a = ${a}`) \/\/ a = 11 \nconsole.log(`b = ${b}`) \/\/ b = 10<\/code><\/pre>\n\n\n\n<p>\u4e0a\u4f8b\u4e2d\uff0c\u5c06a++\u7684\u8fd4\u56de\u503c\u8d4b\u503c\u7ed9b\uff0c\u6b64\u65f6a\u7684\u503c\u4f9d\u7136\u662f11\uff0c\u4f46\u662fb\u7684\u503c\u662f10\u3002\u4e5f\u5c31\u662fa++\u8fd4\u56de\u7684\u662fa\u539f\u6765\u7684\u503c\u3002<\/p>\n\n\n\n<p>\u8fd9\u91cc\u4f60\u9700\u8981\u660e\u786e\u4e00\u70b9a\u548ca++\u4e0d\u662f\u4e00\u56de\u4e8b\uff0ca\u662f\u4e00\u4e2a\u53d8\u91cf\uff0c\u800ca++\u662f\u4e00\u4e2a\u8868\u8fbe\u5f0f\u3002\u5c31\u597d\u50cfa\u548ca+1\u4e00\u6837\uff0c\u4e00\u5b9a\u4e0d\u8981\u63ba\u5408\u5230\u4e00\u8d77\u3002a\u548ca+1\u7684\u503c\u4e0d\u4e00\u6837\uff0c\u540c\u7406a\u548ca++\u7684\u503c\u4e5f\u4e0d\u4e00\u5b9a\u4e00\u6837\u3002<\/p>\n\n\n\n<p>\u6240\u4ee5\u6700\u540e\u603b\u7ed3\u8d77\u6765\uff0c\u65e0\u8bba++\u5199\u5728\u53d8\u91cf\u7684\u524d\u8fb9\u6216\u540e\u8fb9\u5bf9\u4e8e\u53d8\u91cf\u672c\u8eab\u90fd\u662f\u4e00\u6837\u7684\uff0c\u90fd\u4f1a\u589e\u52a01\uff08a++\u548c++a\u90fd\u4f1a\u4f7fa\u7684\u503c\u589e\u52a01\uff09\uff0c\u4e0d\u540c\u70b9\u5728\u4e8e++\u5199\u5728\u540e\u8fb9\uff0c\u5b83\u7684\u8fd4\u56de\u503c\u662f\u53d8\u91cf\u7684\u539f\u6765\u7684\u503c\uff08a++\u7684\u503c\u662fa\u589e\u52a0\u524d\u7684\u503c\uff09\uff0c\u800c++\u5199\u5728\u524d\u8fb9\uff0c\u5b83\u7684\u8fd4\u56de\u503c\u662f\u53d8\u91cf\u589e\u52a0\u540e\u7684\u503c\uff08++a\u7684\u503c\u662fa\u52a0\u4e00\u540e\u7684\u65b0\u503c\uff09\u3002<\/p>\n\n\n\n<p>\u8fd9\u4e00\u5757\u5bf9\u4e8e\u521d\u5b66\u8005\u53ef\u80fd\u4f1a\u6709\u70b9\u96be\u4ee5\u7406\u89e3\uff0c\u4f60\u8981\u505a\u7684\u4e8b\u60c5\u5c31\u662f\u73b0\u5728\u81ea\u5df1\u5199\u4e00\u4e0b\uff0c\u5199\u4e00\u4e0b\u4f60\u5c31\u660e\u767d\u4e86\uff0c\u81ea\u51cf\u5c31\u4e0d\u8bf4\u4e86\uff0c\u81ea\u5df1\u5b9e\u9a8c\u5b9e\u9a8c\u5427\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd0\u7b97\u7b26\u7528\u6765\u5bf9\u4e00\u4e2a\u503c\u6216\u591a\u4e2a\u503c\u8fdb\u884c\u8fd0\u7b97\u6216\u64cd\u4f5c\uff0c\u6240\u4ee5\u8fd0\u7b97\u7b26\u4e5f\u88ab\u7ffb\u8bd1\u4e3a\u64cd\u4f5c\u7b26\u3002\u4f8b\u5982\uff1a+\uff08\u52a0\u53f7\uff09\u7528\u6765\u5bf9\u4e24\u4e2a\u503c\u8fdb\u884c\u52a0\u6cd5\u8fd0\u7b97 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":6045,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[241],"tags":[200,234,247],"_links":{"self":[{"href":"https:\/\/lilichao.com\/index.php?rest_route=\/wp\/v2\/posts\/6070"}],"collection":[{"href":"https:\/\/lilichao.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lilichao.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lilichao.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lilichao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6070"}],"version-history":[{"count":2,"href":"https:\/\/lilichao.com\/index.php?rest_route=\/wp\/v2\/posts\/6070\/revisions"}],"predecessor-version":[{"id":6074,"href":"https:\/\/lilichao.com\/index.php?rest_route=\/wp\/v2\/posts\/6070\/revisions\/6074"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lilichao.com\/index.php?rest_route=\/wp\/v2\/media\/6045"}],"wp:attachment":[{"href":"https:\/\/lilichao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6070"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lilichao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6070"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lilichao.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6070"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}