{"id":564,"date":"2022-07-14T11:40:35","date_gmt":"2022-07-14T03:40:35","guid":{"rendered":"http:\/\/blog.nonot.cn\/?p=564"},"modified":"2024-07-08T12:48:13","modified_gmt":"2024-07-08T04:48:13","slug":"js%e5%87%bd%e6%95%b0%e8%b0%83%e7%94%a8%e7%9a%84%e5%9b%9b%e7%a7%8d%e6%96%b9%e5%bc%8f","status":"publish","type":"post","link":"https:\/\/blog.nonot.cn\/index.php\/2022\/07\/14\/js%e5%87%bd%e6%95%b0%e8%b0%83%e7%94%a8%e7%9a%84%e5%9b%9b%e7%a7%8d%e6%96%b9%e5%bc%8f\/","title":{"rendered":"js\u51fd\u6570\u8c03\u7528\u7684\u56db\u79cd\u65b9\u5f0f"},"content":{"rendered":"<p>javascript\u51fd\u6570\u88ab\u8c03\u7528\u7684\u65b9\u5f0f<br \/>\n1 &#8211; \u5177\u540d\u51fd\u6570\u8c03\u7528<br \/>\n\u4f7f\u7528\u6700\u591a\u7684\u4e00\u79cd\u65b9\u5f0f\uff0c\u7279\u70b9\uff1a\u5b9a\u4e49\u51fd\u6570\u7684\u4ee3\u7801\u53ef\u4ee5\u5199\u5728\u8c03\u7528\u4e4b\u540e<\/p>\n<p>f1();<br \/>\nfunction f1() {<br \/>\nalert(&#8216;\u5177\u540d\u51fd\u6570f1\u88ab\u8c03\u7528\u4e86&#8217;)<br \/>\n}<\/p>\n<p>2 &#8211; \u53d8\u91cf\u5b9a\u4e49\u51fd\u6570\u8c03\u7528<br \/>\n\u4f7f\u7528\u53d8\u91cf\u5b9a\u4e49\u4e00\u4e2a\u51fd\u6570\uff0c\u5fc5\u987b\u5148\u5b9a\u4e49\u53d8\u91cf\uff0c\u624d\u80fd\u8c03\u7528<\/p>\n<p>let f2 = function () {<br \/>\nalert(&#8216;\u53d8\u91cf\u51fd\u6570f2\u88ab\u8c03\u7528\u4e86&#8217;);<br \/>\n}<br \/>\nf2();<\/p>\n<p>3 &#8211; \u533f\u540d\u51fd\u6570\u81ea\u52a8\u8c03\u7528<br \/>\n\u533f\u540d\u51fd\u6570\u6ca1\u6709\u540d\u5b57\uff0c\u51fd\u6570\u5199\u5b8c\u53ef\u7acb\u5373\u8c03\u7528<\/p>\n<p>(function (name) {<br \/>\nalert(&#8216;\u533f\u540d\u51fd\u6570\u88ab\u8c03\u7528\u4e86\uff0c&#8217; + name)<br \/>\n})(&#8216;jack&#8217;)<\/p>\n<p>4 &#8211; \u4e8b\u4ef6\u89e6\u53d1\u56de\u8c03\u51fd\u6570<br \/>\nwindow.onload = function () {<br \/>\nalert(&#8216;\u89e6\u53d1\u4e8b\u4ef6\u56de\u8c03\u51fd\u6570&#8217;)<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>javascript\u51fd\u6570\u88ab\u8c03\u7528\u7684\u65b9\u5f0f 1 &#8211; \u5177&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-564","post","type-post","status-publish","format-standard","hentry","category-javascript"],"_links":{"self":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts\/564","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/comments?post=564"}],"version-history":[{"count":1,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts\/564\/revisions"}],"predecessor-version":[{"id":1122,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts\/564\/revisions\/1122"}],"wp:attachment":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/media?parent=564"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/categories?post=564"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/tags?post=564"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}