Nice article and interesting approach. Thanks!
I have a question however. Why would you use methods to return the string instead of assigning this string to a property like so:
constUsers={admin:'This User is Admin!',client:'This User is Client!',salesman:'This User is Salesman!',default:'This User is MasterUser'}
I mean wouldn't it be more clean and straightforward way?
I was about to comment with the same when I saw this has already been suggested :)
One more cool little enhancement will allow you to adhere to immutability principle (that is if you'd like to prevent anyone from changing your object properties somewhere in the code later):
As a solution-oriented developer, I am a lifelong learner, JavaScript and Swift lover. I'm passionate about creating new things and am motivated by the opportunity to positively impact people's lives.
As a solution-oriented developer, I am a lifelong learner, JavaScript and Swift lover. I'm passionate about creating new things and am motivated by the opportunity to positively impact people's lives.
Hey man ... thanks .. so in the project that i'm current working i used methods to change the data and other things ... it was just a mistake hehehe i'm sorry .. your approach is absolutelly correct... thanks for your review i'm going to edit it ..
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice article and interesting approach. Thanks!
I have a question however. Why would you use methods to return the string instead of assigning this string to a property like so:
I mean wouldn't it be more clean and straightforward way?
I was about to comment with the same when I saw this has already been suggested :)
One more cool little enhancement will allow you to adhere to immutability principle (that is if you'd like to prevent anyone from changing your object properties somewhere in the code later):
From now on your object literal is readonly.
hey man thanks for the comment :D
Hey man ... thanks .. so in the project that i'm current working i used methods to change the data and other things ... it was just a mistake hehehe i'm sorry .. your approach is absolutelly correct... thanks for your review i'm going to edit it ..