Добрый день.
Подскажите пжл как написать функцию, чтобы значение Weekends('long') = const long, а Weekends('short') = const short?
const long = ['saturday', 'sunday'];
const short = ['sat', 'sun'];
const weekends = () => {
}
weekends('long')
Сделал сам:
const long = ['saturday', 'sunday'];
const short = ['sat', 'sun'];
export const getWeekends = (number) => {
switch (number) {
case long:
return ['saturday', 'sunday'];
case short:
return ['sat', 'sun'];
case 'short':
return ['sat', 'sun'];
default:
return ['saturday', 'sunday'];
}
};