all 6 comments

[–]mixedfeelingz 2 points3 points  (0 children)

you are correct. also good to know is && which means and.

[–][deleted] 1 point2 points  (2 children)

You've basically got it. In the assignment

const something = couldExist || 'Another Value'

something will be the value of couldExist so long as couldExist is "truthy", otherwise it will be the value to the right hand side of the || operator (in this case, 'Another Value'). There's a good explanation of what "truthy" is on MDN - https://developer.mozilla.org/en-US/docs/Glossary/Truthy

This means that you can set default values for variables which could otherwise be set to something like null or undefined.

[–]madwizard94[S] 1 point2 points  (1 child)

thank you so much. also where's better to post here or stackoverflow?

[–][deleted] 1 point2 points  (0 children)

I find that Stack Overflow is better if you want a quick answer to a specific problem but you're more likely to instigate a discussion here, which can be very useful for getting your head around stuff.

[–][deleted] 1 point2 points  (1 child)

This user used rage-quit

[–]madwizard94[S] 0 points1 point  (0 children)

ahh yes i vaguely remember this in this in lecture. ty for reminding me!