first attempt to getting a random item from an array

This commit is contained in:
2025-08-27 12:09:24 -04:00
parent 5e88b034ac
commit 274b19f2a9

View File

@@ -0,0 +1,12 @@
const words = [
'red',
'car',
'bed'
];
function getRandomWord() {
console.log('function triggered');
return words[(Math.random() * (3 - 1) + 1)];
}
console.log( getRandomWord() );