Posts

Showing posts from July, 2023

JavaScript Slice() method

  JavaScript Array slice() array .slice( start ,  end ) Description The  slice()  method returns selected elements in an array, as a new array. The  slice()  method selects from a given  start , up to a (not inclusive) given  end . The  slice()  method does not change the original array.   const fruits = [ "Banana" , "Orange" , "Lemon" , "Apple" , "Mango" ];                 //  -5         -4      -3         -2          -1     console . log (fruits . slice ( -4 , -1 ));