Skip to content

Commit 9ebc096

Browse files
committed
Add JavaScript code
1 parent 9750476 commit 9ebc096

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

main.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const ratingSystem = document.getElementById('rating-system');
2+
const submitButton = document.getElementById('submit-button');
3+
const ratingOutputText = document.getElementById('rating-output-text');
4+
let selectedRating = 0;
5+
let totalRating = 0;
6+
let numberOfRatings = 0;
7+
8+
submitButton.addEventListener('click', () => {
9+
totalRating += selectedRating;
10+
numberOfRatings++;
11+
});
12+
13+
function changeRating(rating) {
14+
selectedRating = rating;
15+
}

0 commit comments

Comments
 (0)