JSFiddle - React, Tailwind, and code Playground

by Damien M

JavaScript

var tableau = [42, 12, 6, 3];
var tableau2 = [42, 'Sébastien', 12, 'Laurence'];

alert(tableau[2]); //affiche 6 (3eme colonne)

tableau[2] = 'Non';
alert(tableau[2]);

tableau2.push('Coucou'); //ajoute coucou a la fin tableau
alert(tableau2[4]);

tableau2.unshift('Yolo');//ajoute yolo au début tableau
alert(tableau2[0]);

tableau2.shift();//retire 1er element tableau
alert(tableau2[0]);

tableau2.pop();//retire dernier element tableau
alert(tableau2[3]);