+ 4

i needed a code to find difference between two dates using js

10th Mar 2018, 5:27 PM
2+2=4
2+2=4 - avatar
2 ответов
0
Create a function and set the two dates into variables, inside the function. Then subtract the two and save it to “result”. function dateDiff() { var d1 = date one; var d2 = date two; result = d1 - d2; return result; } Or you can console.log result in the function like so: console.log(result); So when you call the function, it will automatically return the results to the console.
1st Sep 2018, 4:04 AM
Emmanuel Amoh
Emmanuel Amoh - avatar