“Create a star rating component that is fully interactive and dynamic using JavaScript.
```html
Star Rater
```
```js
const starsUL = document.querySelector(".stars");
const output = document.querySelector(".output");
const stars = document.querySelectorAll(".star");
stars.forEach((star, index => {
star.starValue = (index + 1);
star.addEventListener("click", starRate);
});
function starRate(e){
output.innerHTML = `You Rated this ${e.target.starValue}stars`;
stars.forEach((star, index) => {
if(index < e.target.starValue) {
star.classList.add("orange");
}else {
star.classListRemove("orange");
}
});
}
)
```
test the code and let me know in the comments what the results were, as I'm curious to know 😉