원형 방법은 수조에 무게를 준다

8121 단어
/span>html>
lang="en">

    charset="UTF-8">
    </span><span style="font-family:' ';"> </span><span style="color:#e8bf6a;">
</span><span style="color:#e8bf6a;">
</span><span style="color:#e8bf6a;">
</span><span style="color:#e8bf6a;"><script>
</span><span style="color:#e8bf6a;">    </span></span>Array.prototype.<span style="color:#ffc66d;"><span style="background-color:rgb(43,43,43);">method1</span></span>=<span style="color:#cc7832;"><strong><span style="background-color:rgb(43,43,43);">function </span></strong></span>() {
        <span style="color:#cc7832;"><strong><span style="background-color:rgb(43,43,43);">var </span></strong></span>arr=[]<span style="background-color:rgb(43,43,43);"><span style="color:#cc7832;">;
</span><span style="color:#cc7832;">        </span><span style="color:#cc7832;"><strong>for</strong></span></span>(<span style="color:#cc7832;"><strong><span style="background-color:rgb(43,43,43);">var </span></strong></span>i=<span style="background-color:rgb(43,43,43);"><span style="color:#6897bb;">0</span><span style="color:#cc7832;">;</span></span>i<<span style="color:#cc7832;"><strong><span style="background-color:rgb(43,43,43);">this</span></strong></span>.length<span style="color:#cc7832;"><span style="background-color:rgb(43,43,43);">;</span></span>i++){
            <span style="color:#cc7832;"><strong><span style="background-color:rgb(43,43,43);">if</span></strong></span>(arr.<span style="color:#ffc66d;"><span style="background-color:rgb(43,43,43);">indexOf</span></span>(<span style="color:#cc7832;"><strong><span style="background-color:rgb(43,43,43);">this</span></strong></span>[i])==-<span style="color:#6897bb;"><span style="background-color:rgb(43,43,43);">1</span></span>){
                arr.<span style="color:#ffc66d;"><span style="background-color:rgb(43,43,43);">push</span></span>(<span style="color:#cc7832;"><strong><span style="background-color:rgb(43,43,43);">this</span></strong></span>[i])<span style="background-color:rgb(43,43,43);"><span style="color:#cc7832;">;
</span><span style="color:#cc7832;">            </span></span>}
        }
        <span style="color:#cc7832;"><strong><span style="background-color:rgb(43,43,43);">return </span></strong></span>arr<span style="background-color:rgb(43,43,43);"><span style="color:#cc7832;">;
</span><span style="color:#cc7832;">    </span></span>}
    <span style="color:#cc7832;"><strong><span style="background-color:rgb(43,43,43);">var </span></strong></span>arrNum1=[<span style="background-color:rgb(43,43,43);"><span style="color:#6897bb;">1</span><span style="color:#cc7832;">,</span><span style="color:#6897bb;">2</span><span style="color:#cc7832;">,</span><span style="color:#6897bb;">1</span><span style="color:#cc7832;">,</span><span style="color:#6897bb;">2</span><span style="color:#cc7832;">,</span><span style="color:#6897bb;">1</span><span style="color:#cc7832;">,</span><span style="color:#6897bb;">3</span><span style="color:#cc7832;">,</span><span style="color:#6897bb;">2</span><span style="color:#cc7832;">,</span><span style="color:#6897bb;">4</span><span style="color:#cc7832;">,</span><span style="color:#6897bb;">3</span><span style="color:#cc7832;">,</span><span style="color:#6897bb;">5</span><span style="color:#cc7832;">,</span><span style="color:#6897bb;">6</span><span style="color:#cc7832;">,</span><span style="color:#6897bb;">6</span><span style="color:#cc7832;">,</span></span>]
    <span style="color:#cc7832;"><strong><span style="background-color:rgb(43,43,43);">var </span></strong></span>arrNum2=[<span style="background-color:rgb(43,43,43);"><span style="color:#6897bb;">5</span><span style="color:#cc7832;">,</span><span style="color:#6897bb;">4</span><span style="color:#cc7832;">,</span><span style="color:#6897bb;">5</span><span style="color:#cc7832;">,</span><span style="color:#6897bb;">34</span><span style="color:#cc7832;">,</span><span style="color:#6897bb;">6</span><span style="color:#cc7832;">,</span><span style="color:#6897bb;">35</span><span style="color:#cc7832;">,</span><span style="color:#6897bb;">54</span><span style="color:#cc7832;">,</span><span style="color:#6897bb;">45</span><span style="color:#cc7832;">,</span><span style="color:#6897bb;">4545</span><span style="color:#cc7832;">,</span><span style="color:#6897bb;">45</span><span style="color:#cc7832;">,</span></span>]
    <span style="color:#ffc66d;"><span style="background-color:rgb(43,43,43);">alert</span></span>(arrNum1.<span style="color:#ffc66d;"><span style="background-color:rgb(43,43,43);">method1</span></span>())<span style="background-color:rgb(43,43,43);"><span style="color:#cc7832;">;
</span><span style="color:#cc7832;">    </span><span style="color:#ffc66d;">alert</span></span>(arrNum2.<span style="color:#ffc66d;"><span style="background-color:rgb(43,43,43);">method1</span></span>())
<span style="background-color:rgb(43,43,43);"><span style="color:#e8bf6a;"></script>
</span><span style="color:#e8bf6a;">
</span><span style="color:#e8bf6a;"/></span></span></span></span></code></pre> 
 </div> 
</div>
                            </div>
                        </div>

좋은 웹페이지 즐겨찾기