GSG-G7 / whats-going-on

https://whats-going-on-app2.herokuapp.com/
0 stars 1 forks source link

Readability Issue #51

Open MMortaga opened 5 years ago

MMortaga commented 5 years ago

https://github.com/GSG-G7/whats-going-on/blob/fd3f321bef92e1c97e6ad7c748c5f6a9d032e9ff/public/js/dom.js#L10

Someone who is fresh in this field would be like "What on earth is 3600000? :thinking: ". When it comes to weird numbers like this it's always a good idea to store it in a separate variable in order to improve readability for the code. A better of version of the snippet above would be:

const msPerYear = 3600000;
const numOfHours = Math.ceil((Date.now() - Date.parse(publishDate)) / msPerYear);