How can JavaScript be utilized to allow users to change the background color without affecting other users' preferences?

When allowing users to change the background color on a website, it is important to store their preferences individually to avoid affecting other users. One way to achieve this is by using JavaScript to save the user's selected color in their browser's local storage. This way, each user can have their own unique background color without impacting others. ```javascript // Get the user's selected background color from local storage const userColor = localStorage.getItem('userColor'); // Apply the user's selected background color if(userColor) { document.body.style.backgroundColor = userColor; } // Function to change the background color and save it to local storage function changeBackgroundColor(color) { document.body.style.backgroundColor = color; localStorage.setItem('userColor', color); } ```