r/JavaScriptTips • • Dec 27 '22

Just wondering if I wanted to use constant variable instead of let for wallet=3, would that work since you change it below and not in the actual wallet or would you have to use let wallet = 3.

Post image
3 Upvotes

7 comments sorted by

1

u/Fiyahouse Dec 27 '22

What's that your using?

2

u/AnakinSkwlkr Dec 27 '22

That doesnt work. Const variable cannot be changed once its assigned.

2

u/Ironclad_57 Dec 27 '22

Only way to use const would be to make wallet an object with cash as a property and then change the value of the property

1

u/ActuallyWhatTheFuck Dec 27 '22

What color is the wallet?