Firstly, Thank you for taking the time to read my article.
I agree with you we shouldn't use global variables at all. But there might be some scenarios where we might require to use global variables depending on projects.
Well, different developers use different styles for writing a piece of code. In my case, I would prefer to check falsy values by using NOT operator (!), which is very much cleaner and does the job.
Agree with you, it is preferred to use optional chaining operator (?.) with the coalescing operator (?? or ||). Again it depends on the developer, how he/she want to use it. I would do something like this.
Let's not forgot that this article is for beginners who have just started learning JavaScript. What I have cover in this article is just the tip of the iceberg 😉
Lastly, Thanks for the tip, I will make sure to add code snippets instead of images in the future.
Cheers! 👍
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.
Firstly, Thank you for taking the time to read my article.
I agree with you we shouldn't use global variables at all. But there might be some scenarios where we might require to use global variables depending on projects.
Well, different developers use different styles for writing a piece of code. In my case, I would prefer to check falsy values by using NOT operator (
!
), which is very much cleaner and does the job.Agree with you, it is preferred to use optional chaining operator (
?.
) with the coalescing operator (??
or||
). Again it depends on the developer, how he/she want to use it. I would do something like this.Let's not forgot that this article is for beginners who have just started learning JavaScript. What I have cover in this article is just the tip of the iceberg 😉
Lastly, Thanks for the tip, I will make sure to add code snippets instead of images in the future.
Cheers! 👍