JavaScript - 基礎面函數 - 優惠卷函數

 JavaScript  - 基礎面函數 -  優惠卷函數

 注 : 優惠卷的時間格式一樣

function checkCoupon(enteredCode, correctCode, currentDate, expirationDate){
  return enteredCode === correctCode && Date.parse(expirationDate) >= Date.parse(currentDate)
}

// enteredCode 輸入的優惠卷碼
// correctCode 匹配的優惠卷碼
// currentDate 你的優惠卷時間
// expirationDate 匹配的優惠卷時間

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章