why do we use tostring method in date function in javascript code example Example: convert date to string javascript var d = new Date(); var n = d.toDateString();