Slice a string
<html>
<body>
<button onclick="var myS = new String('www.java2s.com'); alert(myS.slice(4,7));">
SLICE STRING
</button>
<button onclick="var myA = new Array(10,11,12,13,14,15,11,12,13,14); alert(myA.slice(1,3));">
SLICE ARRAY
</button>
</body>
</html>
Related examples in the same category