// Get all the reviews on the page const reviews = document.querySelectorAll('.review'); // Define the keywords to look for and their associated highlight colors const keywords = { 'work': 'yellow', 'experience': 'yellow', 'unpleasant': 'yellow', 'felt': 'green' }; // Loop through each review and highlight the keywords reviews.forEach((review) => { // Get the text content of the review const reviewText = review.textContent.toLowerCase(); // Loop through each keyword and highlight it if it's found in the review Object.keys(keywords).forEach((keyword) => { if (reviewText.includes(keyword)) { const regex = new RegExp(keyword, 'gi'); const highlightedText = review.innerHTML.replace(regex, `<span style="background-color:${keywords[keyword]}">${keyword}</span>`); review.innerHTML = highlightedText; } }); });