{"id":957,"date":"2024-04-15T17:47:31","date_gmt":"2024-04-15T08:47:31","guid":{"rendered":"http:\/\/inwelly.com\/?p=957"},"modified":"2024-04-22T05:06:58","modified_gmt":"2024-04-21T20:06:58","slug":"javascript-%ed%8a%b9%ec%a0%95%eb%b2%94%ec%9c%84%ec%9d%98-%ec%88%ab%ec%9e%90-%ec%95%88%ec%97%90-%eb%b9%a0%ec%a0%b8-%ec%9e%88%eb%8a%94%ea%b2%83-%ed%99%95%ec%9d%b8-%ed%91%9c%ec%8b%9c","status":"publish","type":"post","link":"https:\/\/inwelly.com\/?p=957","title":{"rendered":"JAVASCRIPT \ud2b9\uc815\ubc94\uc704\uc758 \uc22b\uc790 \uc548\uc5d0 \ube60\uc838 \uc788\ub294\uac83 \ud655\uc778 \ud45c\uc2dc"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>function inven_arr_list(INVENSTR)<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>var invenVal =INVENSTR ;&nbsp;<\/p>\n\n\n\n<p>var arr = invenVal.split(&#8220;,&#8221;);<\/p>\n\n\n\n<p>var arr_val = 0 ;<\/p>\n\n\n\n<p>var inputarr = [] ;<\/p>\n\n\n\n<p>var val_sum = &#8220;&#8221;;<\/p>\n\n\n\n<p>$.each(arr, function(i, obj)<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>arr_val = arr[i] * 1 ;<\/p>\n\n\n\n<p>inputarr.push(arr_val);<\/p>\n\n\n\n<p>})<\/p>\n\n\n\n<p>if( inputarr.length == 23 )<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>&nbsp;\/\/console.log(&#8220;\uc804\uccb4&#8221;);<\/p>\n\n\n\n<p>&nbsp;val_sum = val_sum + &#8220;\uc804\uccb4&#8221;;<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>else<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>function sliceFn(val)<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>var str = val ;<\/p>\n\n\n\n<p>str = &#8220;00&#8221; + str ;<\/p>\n\n\n\n<p>str = str.slice(-2);<\/p>\n\n\n\n<p>return str;<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>function inArray(myArray,myValue){<\/p>\n\n\n\n<p>&nbsp; &nbsp; var inArray = false;<\/p>\n\n\n\n<p>&nbsp; &nbsp; myArray.map(function(key){<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; if (key === myValue){<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inArray=true;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; }<\/p>\n\n\n\n<p>&nbsp; &nbsp; });<\/p>\n\n\n\n<p>&nbsp; &nbsp; return inArray;<\/p>\n\n\n\n<p>};<\/p>\n\n\n\n<p>var emptyval = inputarr[0] ;<\/p>\n\n\n\n<p>for(var j=1; j&lt;=23; j++)<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>if( inArray(inputarr, j) )<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>if( emptyval == null )<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>emptyval = sliceFn(j) ;<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>else<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>if( emptyval != null )<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>\/\/console.log(sliceFn(emptyval)+&#8221; ~ &#8220;+ sliceFn(j));<\/p>\n\n\n\n<p>if( j &gt; emptyval )<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>val_sum = val_sum +&#8221;,&#8221;+ sliceFn(emptyval)+&#8221; .~ &#8220;+ sliceFn(j) ;<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>emptyval = null;<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>if( emptyval != null )<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>if( inputarr[inputarr.length-1] == 23 )<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>\/\/console.log( sliceFn(emptyval) + &#8221; ~ 24&#8243;);<\/p>\n\n\n\n<p>val_sum = val_sum +&#8221;,&#8221;+ sliceFn(emptyval) + &#8221; ~ 24&#8243;;<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>else<\/p>\n\n\n\n<p>{<\/p>\n\n\n\n<p>\/\/console.log( sliceFn(emptyval) + &#8221; ~ &#8220;+ sliceFn( inputarr[inputarr.length-1] ));<\/p>\n\n\n\n<p>val_sum = val_sum +&#8221;,&#8221;+ sliceFn(emptyval) + &#8221; ~. &#8220;+ sliceFn( inputarr[inputarr.length-1] ) ;<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>val_sum = val_sum.substring(1);<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>return val_sum;<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>var INVENSTR =&nbsp; &#8220;02,03,04,05,06,07,08,09,10,12,13,14,15,16,17,18,19,20,21,22&#8221;;<\/p>\n\n\n\n<p>console.log(&#8220;val_sum :&#8221;+inven_arr_list(INVENSTR));<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>function inven_arr_list(INVENSTR) { var invenVal =INVENSTR ;&nbsp; var arr = invenVal.split(&#8220;,&#8221;); var arr_val = 0 ; var inputarr = [] [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1279,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-957","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript"],"_links":{"self":[{"href":"https:\/\/inwelly.com\/index.php?rest_route=\/wp\/v2\/posts\/957","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/inwelly.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/inwelly.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/inwelly.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/inwelly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=957"}],"version-history":[{"count":1,"href":"https:\/\/inwelly.com\/index.php?rest_route=\/wp\/v2\/posts\/957\/revisions"}],"predecessor-version":[{"id":958,"href":"https:\/\/inwelly.com\/index.php?rest_route=\/wp\/v2\/posts\/957\/revisions\/958"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/inwelly.com\/index.php?rest_route=\/wp\/v2\/media\/1279"}],"wp:attachment":[{"href":"https:\/\/inwelly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=957"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/inwelly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=957"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/inwelly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=957"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}