Generation

generate functionThu, 10 Nov 2022

Catch when a array index does not exist

const arr = [1, 2, 3, 4, 5]; try { console.log(arr[10]); } catch(err) { console.log("Hey, this index does not exist"); }

Javascript
Generate More

Want to kickstart your project?Use the new AI Studio to create your code