{"id":789,"date":"2024-02-02T14:42:44","date_gmt":"2024-02-02T05:42:44","guid":{"rendered":"https:\/\/blog.mydepot.kr\/?p=789"},"modified":"2024-02-02T14:42:44","modified_gmt":"2024-02-02T05:42:44","slug":"javascript-%eb%ac%b8%ec%9e%90%ec%97%b4-%ed%8f%ac%ed%95%a8-%ec%97%ac%eb%b6%80-%ed%99%95%ec%9d%b8%ed%95%98%ea%b8%b0","status":"publish","type":"post","link":"https:\/\/blog.mydepot.kr\/?p=789","title":{"rendered":"[javascript] \ubb38\uc790\uc5f4 \ud3ec\ud568 \uc5ec\ubd80 \ud655\uc778\ud558\uae30"},"content":{"rendered":"\n<p>\ubb38\uc790\uc5f4 A\uac00 \ubb38\uc790\uc5f4 B\uc5d0 \ud3ec\ud568\ub418\uc5b4 \uc788\ub294\uc9c0 \ud655\uc778\ud558\ub294 \ud568\uc218\uc774\ub2e4.<\/p>\n\n\n\n<p>\uc704\uce58\ub294 \ubb34\uad00\ud558\uace0, A\uac00 \uc628\uc804\ud788 \uc5f0\uc18d\uc801\uc73c\ub85c \uc874\uc7ac\ud574\uc57c \ud55c\ub2e4.<\/p>\n\n\n\n<p>\ud55c\uae00\ub3c4 \ucc98\ub9ac\ub41c\ub2e4.<\/p>\n\n\n\n<p><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\n\/\/ \ubb38\uc790\uc5f4 \ubc30\uc5f4\ud654\nexport const splitKoreanStrToArr = (str = &quot;&quot;) =&gt; {\n      const cho = &#x5B;&quot;\u3131&quot;, &quot;\u3132&quot;, &quot;\u3134&quot;, &quot;\u3137&quot;, &quot;\u3138&quot;, &quot;\u3139&quot;, &quot;\u3141&quot;, &quot;\u3142&quot;, &quot;\u3143&quot;, &quot;\u3145&quot;, &quot;\u3146&quot;, &quot;\u3147&quot;, &quot;\u3148&quot;, &quot;\u3149&quot;, &quot;\u314a&quot;, &quot;\u314b&quot;, &quot;\u314c&quot;, &quot;\u314d&quot;, &quot;\u314e&quot;];\n      const jung = &#x5B;&quot;\u314f&quot;, &quot;\u3150&quot;, &quot;\u3151&quot;, &quot;\u3152&quot;, &quot;\u3153&quot;, &quot;\u3154&quot;, &quot;\u3155&quot;, &quot;\u3156&quot;, &quot;\u3157&quot;, &quot;\u3158&quot;, &quot;\u3159&quot;, &quot;\u315a&quot;, &quot;\u315b&quot;, &quot;\u315c&quot;, &quot;\u315d&quot;, &quot;\u315e&quot;, &quot;\u315f&quot;, &quot;\u3160&quot;, &quot;\u3161&quot;, &quot;\u3162&quot;, &quot;\u3163&quot;];\n      const jong = &#x5B;&quot;&quot;, &quot;\u3131&quot;, &quot;\u3132&quot;, &quot;\u3133&quot;, &quot;\u3134&quot;, &quot;\u3135&quot;, &quot;\u3136&quot;, &quot;\u3137&quot;, &quot;\u3139&quot;, &quot;\u313a&quot;, &quot;\u313b&quot;, &quot;\u313c&quot;, &quot;\u313d&quot;, &quot;\u313e&quot;, &quot;\u313f&quot;, &quot;\u3140&quot;, &quot;\u3141&quot;, &quot;\u3142&quot;, &quot;\u3144&quot;, &quot;\u3145&quot;, &quot;\u3146&quot;, &quot;\u3147&quot;, &quot;\u3148&quot;, &quot;\u314a&quot;, &quot;\u314b&quot;, &quot;\u314c&quot;, &quot;\u314d&quot;, &quot;\u314e&quot;];\n\n      return &#x5B;...str].flatMap(char =&gt; {\n            const charCode = char.charCodeAt(0) - 44032;\n            if (charCode &lt; 0 || charCode &gt; 11171) return char;\n\n            const choIdx = Math.floor(charCode \/ 588);\n            const jungIdx = Math.floor((charCode - (choIdx * 588)) \/ 28);\n            const jongIdx = Math.floor(charCode % 28);\n\n            return &#x5B;cho&#x5B;choIdx], jung&#x5B;jungIdx], jong&#x5B;jongIdx]].filter(Boolean);\n      });\n}\n\n\n\/\/ \ubc30\uc5f4 \uc5f0\uc18d \ud3ec\ud568 \uc5ec\ubd80\nexport const arrIncludeCheck = (arrA = &#x5B;], arrB = &#x5B;]) =&gt; {\n      let idxB = arrB.join(&#039;,&#039;).indexOf(arrA.join(&#039;,&#039;))\n\n      return idxB !== -1\n}\n\n\/\/ \ubb38\uc790\uc5f4 \ud3ec\ud568 \ube44\uad50 \uc5ec\ubd80\nexport const stringContainCheck = (str1 = &quot;&quot;, str2 = &quot;&quot;) =&gt; {\n      const arr1 = splitKoreanStrToArr(str1)\n      const arr2 = splitKoreanStrToArr(str2)\n\n      return arrIncludeCheck(arr1, arr2)\n}\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>\ubb38\uc790\uc5f4 A\uac00 \ubb38\uc790\uc5f4 B\uc5d0 \ud3ec\ud568\ub418\uc5b4 \uc788\ub294\uc9c0 \ud655\uc778\ud558\ub294 \ud568\uc218\uc774\ub2e4. \uc704\uce58\ub294 \ubb34\uad00\ud558\uace0, A\uac00 \uc628\uc804\ud788 \uc5f0\uc18d\uc801\uc73c\ub85c \uc874\uc7ac\ud574\uc57c \ud55c\ub2e4. \ud55c\uae00\ub3c4 \ucc98\ub9ac\ub41c\ub2e4.<\/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":[406,407,13,36,404,405],"class_list":["post-789","post","type-post","status-publish","format-standard","hentry","category-javascript","tag-406","tag-407","tag-13","tag-36","tag-404","tag-405"],"modified_by":"\ucc38\ube5b\ubc14\ub2e4","_links":{"self":[{"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=\/wp\/v2\/posts\/789","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=789"}],"version-history":[{"count":1,"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=\/wp\/v2\/posts\/789\/revisions"}],"predecessor-version":[{"id":790,"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=\/wp\/v2\/posts\/789\/revisions\/790"}],"wp:attachment":[{"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=789"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=789"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}