Javascript – Storing function in object – bad practice? [closed]

The first approach is preferred. This way you are explicitly defining the scope of your functions instead of polluting the global scope. There are no downsides of using the first approach. Only upsides 🙂

Conclusion: always use the first approach to define functions. The second is like javascript in the 90s, let’s leave it rest in peace back in the past and use proper scoping.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)