// Define an array of jokes
const jokes = [
"Why don't scientists trust atoms? Because they make up everything!",
"What did one wall say to the other wall? I'll meet you at the corner!",
"Why did the bicycle fall over? Because it was two-tired!",
"I used to play piano by ear, but now I use my hands.",
"How do you organize a space party? You planet!",
"What did the janitor say when he jumped out of the closet? Supplies!",
"I'm reading a book on anti-gravity. It's impossible to put down!",
"Why did the math book look sad? Because it had too many problems.",
"Why don't oysters donate to charity? Because they are shellfish!",
"How do you make a tissue dance? You put a little boogie in it!",
];
// Get the table body element
function addJokes() {
const tbody = document.getElementById('result');
// Shuffle the jokes array using Lodash
const shuffledJokes = _.shuffle(jokes);
// Loop through the table rows and add a joke to each row
for (let i = 1; i <= 3; i++) {
// Get the i-th joke from the shuffled array
const joke = shuffledJokes[i - 1];
// Create a new table row and cell elements
const tr = document.createElement('tr');
const tdNumber = document.createElement('td');
const tdJoke = document.createElement('td');
// Set the text content of the row and cell elements
tdNumber.textContent = i;
tdJoke.textContent = joke;
// Append the cell elements to the row element
tr.appendChild(tdNumber);
tr.appendChild(tdJoke);
// Append the row element to the table body element
tbody.appendChild(tr);
}
}
addJokes();