JavaScript - 基礎面函數 - 優惠卷函數
注 : 優惠卷的時間格式一樣
function checkCoupon(enteredCode, correctCode, currentDate, expirationDate){
return enteredCode === correctCode && Date.parse(expirationDate) >= Date.parse(currentDate)
}
// enteredCode 輸入的優惠卷碼
// correctCode 匹配的優惠卷碼
// currentDate 你的優惠卷時間
// expirationDate 匹配的優惠卷時間