Javascript array slice basic explanation needed

I learn this Array prototype slice

This is the Array:

const animals = ['ant', 'bison', 'camel', 'duck', 'elephant'];

This is the line:

console.log(animals.slice(1, 2));

This is the output:

outputs ["bison"]

Why is this not outputting ["bison", "camel"] since the doc state it’s a zero because operation?

enter image description here

27 thoughts on “Javascript array slice basic explanation needed”

  1. 757455 593205Does your weblog have a contact page? Im having a tough time locating it but, Id like to send you an e-mail. Ive got some suggestions for your weblog you may be interested in hearing. Either way, excellent website and I appear forward to seeing it expand more than time. 498541

  2. 578632 31592Pretty part of content material. I just stumbled upon your weblog and in accession capital to assert that I get actually loved account your weblog posts. Any way Ill be subscribing on your feeds or even I success you access constantly rapidly. 533556


Leave a Comment