array mapping with array slice - Javascript Array

Javascript examples for Array:slice

Description

array mapping with array slice

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width"> 
   </head> 
   <body> 
      <script>
const array = [{name:'A'},{name:'B'},{name:'C'},{name:'D'},{name:'E'},{name:'F'},{name:'G'},{name:'H'},{name:'I'}];
let i = 0//from   www .j  av  a 2 s . com
setInterval(() => {
  console.log(array.slice(i,i+3))
  i*3 > array.length ? i=0 : i += 3
}, 3000)

      </script>  
   </body>
</html>

Related Tutorials