Yoshiya@kt3k・Sep 1, 2023, 4:44 PM

誕生日を入れると、年齢を number で返してくれる関数 (誕生日は Date でパーズできる形式)

const age = (s) => (Date.now() - new Date(s)) / (365 * 24 * 3600 * 1000)