DEV Community

Discussion on: 8 techniques to write cleaner JavaScript code

Collapse
 
luishrodg profile image
Luis Rodrigues

I believe that what Raghav meant was, if you put this variable in an kind of component that calculation will be done every time that i use the component.

use this:

const DAY_IN_MILLISECONDS = 86400000 // 3600 * 24 * 1000
Enter fullscreen mode Exit fullscreen mode
Thread Thread
 
codewithahsan profile image
Muhammad Ahsan Ayaz

Oh. Yeah, definitely. This should most likely be in a constants file or something. You're right.