📌  相关文章
📜  javascript weekday text hackerrank 解决方案 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:25.081000             🧑  作者: Mango

代码示例1
function weekdayText(weekdays) {
     return function getText(target) {
       return weekdays[target] || (function() {
         throw new Error(`Invalid weekday numer ${target}`)
       }());
     }
   }

   daysInWeek = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
   
   getText = weekdayText(daysInWeek)
   
   console.log(getText(5))