在代码片段的if else语句中,值<0和-1的含义是什么。我知道它做什么,但是不明白为什么?
var partyButton = document.getElementById("partyTimeButton");
var partyEvent = function(){
if( partyTime < 0 ){
partyTime = new Date().getHours();
partyButton.innerText = "Party Over!";
partyButton.style.backgroundColor = "#0A8DAB";
}else if( partyTime = -1 ){
partyButton.innerText = "Party Time!";
partyButton.style.backgroundColor = "#222";
}
}
partyButton.addEventListener('click', partyEvent);
partyEvent();