"Array slice"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
 
4번째 줄: 4번째 줄:
==JavaScript==
==JavaScript==
[[Category:JavaScript]]
[[Category:JavaScript]]
<source lang='javascript'>
<syntaxhighlight lang='javascript'>
var fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
var fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
var arr = fruits.slice(3,4); // Apple
var arr = fruits.slice(3,4); // Apple
</source>
</syntaxhighlight>
<source lang='javascript'>
<syntaxhighlight lang='javascript'>
var fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
var fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
var arr = fruits.slice(3,5); // Apple,Mango
var arr = fruits.slice(3,5); // Apple,Mango
</source>
</syntaxhighlight>
<source lang='javascript'>
<syntaxhighlight lang='javascript'>
var fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
var fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
var arr = fruits.slice(-3,-2); // Lemon
var arr = fruits.slice(-3,-2); // Lemon
</source>
</syntaxhighlight>
<source lang='javascript'>
<syntaxhighlight lang='javascript'>
var fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
var fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
var arr = fruits.slice(-3,-1); // Lemon,Apple
var arr = fruits.slice(-3,-1); // Lemon,Apple
</source>
</syntaxhighlight>
*http://www.w3schools.com/jsref/jsref_slice_array.asp
*http://www.w3schools.com/jsref/jsref_slice_array.asp



2020년 11월 2일 (월) 02:51 기준 최신판

slice

1 JavaScript[ | ]

var fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
var arr = fruits.slice(3,4); // Apple
var fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
var arr = fruits.slice(3,5); // Apple,Mango
var fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
var arr = fruits.slice(-3,-2); // Lemon
var fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
var arr = fruits.slice(-3,-1); // Lemon,Apple

2 See Also[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}