xxxxxxxxxx
30
// Create an empty array
// Declare the variable arr and initialize it with an empty array
//let arr = [];
// Create an array with values
let arr = [1, 2, 3, 4, 5, 'sam'];
// Log the length of the array
console.log(arr.length);
for(let n = 0; n < 10; n++) {
// Add the value 'hello' to the end of the array
arr.push('hello');
// Add the value 'hello' to the array at index n
//arr[n] = "hello";
}
// Loop through the length of the array
for(let i = 0; i < arr.length; i++) {
// Print out the index i and the value stored at index i
console.log(i, arr[i]);
}
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
}