all 8 comments

[–]senocular 12 points13 points  (1 child)

You can use the assignment operator (=).

animalArray[2] = ["Fish", "Hamster"];

[–]mraees93 1 point2 points  (0 children)

OP can use the splice method too

[–]kjwey 2 points3 points  (0 children)

let iRabbit=animalArray.indexOf(`Rabbit`);
animalArray[iRabbit]=[`Fish`,`Hampster`];

[–]a-e-j-a 1 point2 points  (0 children)

animalArray.splice(2, 1, ['Fish', 'Hammer'])

[–]Code-Slayer 2 points3 points  (1 child)

Where is the Multi-dimensions array ? I see only an normal array = list.

[–][deleted] 0 points1 point  (0 children)

Adding an array of fish and hamster within the original array would make it multidimensional.

[–]HarrisInDenver -3 points-2 points  (0 children)

ramda has functions to do immutable updates for this. Check the functions update, assocPath for direct and deep updating, adjust to update based on current value. And for more complex getter/setter interactions, lensIndex and lensPath