xxxxxxxxxx
22
let numbers = [1, 3, 5, 7, 9];
function setup() {
createCanvas(400, 400);
textSize(15);
}
function draw() {
background(220);
text(numbers, 10, 20);
text("After numbers.push(100);", 10, 50);
numbers.push(100);
text(numbers, 10, 70);
text("After numbers.splice(2, 1);", 10, 110);
numbers.splice(2, 1); //(index, number of elements to be removed)
text(numbers, 10, 130);
noLoop();
}