-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoneLine.ts
More file actions
11 lines (6 loc) · 774 Bytes
/
oneLine.ts
File metadata and controls
11 lines (6 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
export const boolToWord = (bool: boolean): string => bool ? 'Yes' : 'No';
const checkCoupon = (enteredCode: string, correctCode: string, currentDate: string, expirationDate: string): boolean => Date.parse(expirationDate) - Date.parse(currentDate) >= 0 && enteredCode === correctCode;
const bouncingBall = (h: number, bounce: number, window: number): number => h > 0 && bounce > 0 && bounce < 1 && window < h ? Math.floor(Math.log(window / h) / Math.log(bounce)) * 2 + 1 : -1;
export const centuryFromYear = (year: number): number => Number((year - 1).toString().slice(0, -2)) + 1;
const bonusTime = (salary:number, bonus:boolean):string => `£${bonus ? salary * 10 : salary}`;
const greet = (name: string): string => `Hello, ${name === "Johnny" ? 'my love' : name}!`;