Do you have any question?
const viewportWidth = window.innerWidth - size; // Adjust for snowflake size
snowflake.style.left = `${Math.random() * viewportWidth}px`; // Constrain within viewport width
snowflake.remove(); // Remove when it goes off the bottom edge