{"id":186,"date":"2021-02-23T10:34:13","date_gmt":"2021-02-23T01:34:13","guid":{"rendered":"https:\/\/blog.mydepot.kr\/?p=186"},"modified":"2021-09-03T10:55:16","modified_gmt":"2021-09-03T01:55:16","slug":"%ec%9e%90%eb%b0%94%ec%8a%a4%ed%81%ac%eb%a6%bd%ed%8a%b8-%eb%b0%98%eb%b3%b5%eb%a9%94%ec%86%8c%eb%93%9c%eb%b0%98%eb%b3%b5%eb%ac%b8","status":"publish","type":"post","link":"https:\/\/blog.mydepot.kr\/?p=186","title":{"rendered":"[\uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8] \ubc18\ubcf5\uba54\uc18c\ub4dc(\ubc18\ubcf5\ubb38) + \ubc30\uc5f4 \ucc98\ub9ac"},"content":{"rendered":"\n<ul class=\"wp-block-list\"><li>forEach, for, while (\uc77c\ubc18\uc801\uc778 \ubc18\ubcf5\ubb38)<\/li><\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst array1 = &#x5B;&#039;a&#039;, &#039;b&#039;, &#039;c&#039;];\n\narray1.forEach(element =&gt; console.log(element));\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\"><li>map (\ubc30\uc5f4 \ubc18\ud658)<\/li><\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst array1 = &#x5B;1, 4, 9, 16];\n\nconst map1 = array1.map(x =&gt; x * 2);\n\nconsole.log(map1);\n\/\/ \uacb0\uacfc &#x5B;2, 8, 18, 32]\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\"><li>filter (\uc870\uac74\uc5d0 \ub530\ub77c true\uc778 \uac12\ub9cc \ubc30\uc5f4\ub85c \ubc18\ud658)<\/li><\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst words = &#x5B;&#039;spray&#039;, &#039;limit&#039;, &#039;elite&#039;, &#039;exuberant&#039;, &#039;destruction&#039;, &#039;present&#039;];\n\nconst result = words.filter(item =&gt; item.length &gt; 6);\n\nconsole.log(result);\n\/\/ \uacb0\uacfc &#x5B;&quot;exuberant&quot;, &quot;destruction&quot;, &quot;present&quot;]\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\"><li>reduce (\ubc30\uc5f4 \uac12\uc744 \uc870\ud569\ud574\uc11c \ud558\ub098\uc758 \uac12\uc73c\ub85c \ubc18\ud658)<\/li><\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst array1 = &#x5B;1, 2, 3, 4];\nconst reducer = (accumulator, currentValue) =&gt; accumulator + currentValue;\n\nconsole.log(array1.reduce((accumulator, currentValue) =&gt; accumulator + currentValue));\n\/\/ \uacb0\uacfc 10\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\"><li>some (\uc870\uac74\uc5d0 \ub530\ub77c true\uc778 \uac12\uc774 \uc788\uc73c\uba74 \ubc14\ub85c true \ubc18\ud658, \uc5c6\uc73c\uba74 false \ubc18\ud658)<\/li><\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nlet arr = &#x5B;2, 4, 6, 8, 10, 12, 14, 22, 99, 100];\nlet choose12 = arr.some((value) =&gt; {\n    if (value === 12) {\n        return true;\n    }\n});\n\n\/\/ \uacb0\uacfc true (12\uc5d0\uc11c break)\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\"><li>every (\uc870\uac74\uc5d0 \ub530\ub77c \ubaa8\ub4e0 \uc6d0\uc18c\uac00 true \uc774\uba74 true \ubc18\ud658, \ud558\ub098\ub77c\ub3c4 false \uc774\uba74 false \ubc18\ud658)<\/li><\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nlet arr = &#x5B;2, 4, 6, 8, 10, 11, 14, 22, 99, 100];\nlet isEven = arr.every((value) =&gt; {\n    if (value % 2 === 0) {\n        return true;\n    }\n});\n\n\/\/ \uacb0\uacfc false (11\uc5d0\uc11c break)\n<\/pre><\/div>\n\n\n<p><li>\ubc30\uc5f4\uc758 \uccab\ubc88\uc9f8 \uac12\uacfc \ub098\uba38\uc9c0 \uac12\uc744 \ubd84\ub9ac<\/li><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nlet arr = &#x5B;2, 4, 6, 8, 10, 11, 14, 22, 99, 100];\nconst &#x5B;firstval, ...otherVals] = arr;\n\nconsole.log(firstVal); \/\/ \uacb0\uacfc 2\nconsole.log(otherVals); \/\/ \uacb0\uacfc &#x5B;4,6,8,10,11,14,22,99,100]\n<\/pre><\/div>\n\n\n<p><li>\ubc30\uc5f4\uc758 \uc911\ubcf5\uac12 \uc81c\uac70<\/li><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nlet arr = &#x5B;2, 4, 6, 4, 10, 3];\narr = &#x5B;...new Set(arr)];\n\nconsole.log(arr); \/\/ \uacb0\uacfc &#x5B;2, 6, 10, 3]\n<\/pre><\/div>\n\n\n<p><li>\ubc30\uc5f4\uc758 null, undefined, false \uac12 \uc81c\uac70 (filter \uba54\uc18c\ub4dc \uc751\uc6a9)<\/li><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nlet arr = &#x5B;1, undefined, &quot;dd&quot;, null, false, true];\nlet filteredArr = arr.filter(Boolean);\n\nconsole.log(filteredArr); \/\/ \uacb0\uacfc &#x5B;1, &quot;dd&quot;, true]\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>forEach, for, while (\uc77c\ubc18\uc801\uc778 \ubc18\ubcf5\ubb38) map (\ubc30\uc5f4 \ubc18\ud658) filter (\uc870\uac74\uc5d0 \ub530\ub77c true\uc778 \uac12\ub9cc \ubc30\uc5f4\ub85c \ubc18\ud658) reduce (\ubc30\uc5f4 \uac12\uc744 \uc870\ud569\ud574\uc11c \ud558\ub098\uc758 \uac12\uc73c\ub85c \ubc18\ud658) some (\uc870\uac74\uc5d0 \ub530\ub77c true\uc778 \uac12\uc774 \uc788\uc73c\uba74 \ubc14\ub85c true \ubc18\ud658, \uc5c6\uc73c\uba74 false \ubc18\ud658) every (\uc870\uac74\uc5d0 \ub530\ub77c \ubaa8\ub4e0 \uc6d0\uc18c\uac00 true \uc774\uba74 true \ubc18\ud658, \ud558\ub098\ub77c\ub3c4 false \uc774\uba74 false \ubc18\ud658) \ubc30\uc5f4\uc758 \uccab\ubc88\uc9f8 \uac12\uacfc \ub098\uba38\uc9c0 \uac12\uc744 \ubd84\ub9ac \ubc30\uc5f4\uc758 &#8230; <a title=\"[\uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8] \ubc18\ubcf5\uba54\uc18c\ub4dc(\ubc18\ubcf5\ubb38) + \ubc30\uc5f4 \ucc98\ub9ac\" class=\"read-more\" href=\"https:\/\/blog.mydepot.kr\/?p=186\" aria-label=\"[\uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8] \ubc18\ubcf5\uba54\uc18c\ub4dc(\ubc18\ubcf5\ubb38) + \ubc30\uc5f4 \ucc98\ub9ac\uc5d0 \ub300\ud574 \ub354 \uc790\uc138\ud788 \uc54c\uc544\ubcf4\uc138\uc694\">\ub354 \uc77d\uae30<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[7],"tags":[13,51,52],"class_list":["post-186","post","type-post","status-publish","format-standard","hentry","category-javascript","tag-13","tag-51","tag-52"],"modified_by":"\ucc38\ube5b\ubc14\ub2e4","_links":{"self":[{"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=\/wp\/v2\/posts\/186","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=186"}],"version-history":[{"count":6,"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=\/wp\/v2\/posts\/186\/revisions"}],"predecessor-version":[{"id":326,"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=\/wp\/v2\/posts\/186\/revisions\/326"}],"wp:attachment":[{"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=186"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=186"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}