Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript print subarray from index to indeex

const ar  = [1, 2, 3, 4, 5];

// slice from 1..3 - add 1 as the end index is not included
const ar2 = ar.slice(1, 3 + 1);

console.log(ar2);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #print #subarray #index #indeex
ADD COMMENT
Topic
Name
5+1 =