01 - Learn Basic Javascript by Building a Role Playing Game - Step 20

This step requires the use of var. I thought var is obsolete and I should use let or const instead. Please advise.

1 Like

I updated your post to inlcude the challenge link.

But var is not necessarily obsolete.
It just has some interesting behaviors that let and const don’t share and that is why it is preferred to use those.

But when learning JavaScript, it is important that you understand that var exists and what it does before moving onto let and const.
The first few lessons use var but then replace it with let and const.

Hope that helps :+1:

1 Like

This is a good article explaining those weird behaviors I was talking about earlier with var and why it is better to use let and const

1 Like

Thank you for replying so promptly

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.