0life-web/js/star.js

30 lines
445 B
JavaScript

// Adding stars on click theStar
let star = 0;
let starGained = 0;
function starClicked() {
star ++;
starGained ++;
changeName();
};
function changeName() {
let see = document.getElementById('name').dataset.value;
let num = see.split('-');
let show
if (star <= 1 && star >= -1) {
show = star + '-Star';
} else {
show = star + '-Stars';
};
document.querySelector(".magic").dataset.value = show;
magic();
};