ในการรับวันที่ของวันพรุ่งนี้ด้วย JavaScript คุณเพียงแค่ต้องได้รับวันที่ปัจจุบัน แล้วเพิ่มหนึ่งวันเข้าไปดังนี้:
const today = new Date()
const tomorrow = new Date(today)
tomorrow.setDate(tomorrow.getDate() + 1)
tomorrow.toDateString() ตอนนี้ให้ลองออกจากระบบคอนโซลเมื่อวานนี้:
console.log(tomorrow.toDateString()) ดีและเรียบง่าย!