Coding error ??

Joined
Jan 6, 2025
Messages
4
Reaction score
1
20250106_082740.jpg


I was taught const = consistent / doesn't change over time! And let = creates values that are likely to change overtime.


pls see image: and please explain to me why I originally got this question wrong!
I used let for age instead of the apparent correct answer which was const, and this goes against everything this app originally taught me ?!?!?!

Thanks in advance.
 
Joined
Jan 6, 2025
Messages
4
Reaction score
1
We're need for a more details - question text, task context. And this forum specified for Java, not JavaScript.
Once Mino is done with that question it moves onto a different question so their really isn't much context to give. but can yon give me a scenario whereby you would use const for an age value, so I have a better understanding.

thanks for your reply
 
Joined
Jan 6, 2025
Messages
3
Reaction score
1
Once Mino is done with that question it moves onto a different question so their really isn't much context to give. but can yon give me a scenario whereby you would use const for an age value, so I have a better understanding.

thanks for your reply
const can't be used for age value storing. const represents permanent value like Pi, exception messages, RegEx patterns - use it for data that has rarely changes
 
Joined
Jan 6, 2025
Messages
4
Reaction score
1
const can't be used for age value storing. const represents permanent value like Pi, exception messages, RegEx patterns - use it for data that has rarely changes
So why does Mimo tell me I'm wrong when I used the let variable for an age value? I think I may need to flag that on Mimos site.

but thanks for clarifying that I was right 👍
 
Joined
Sep 21, 2022
Messages
209
Reaction score
28
If you are going to change it, while the program is running, use a variable.

If you are not going to change it, while the program is running, use a variable or a constant.

If it must not be changed, while the program is running, and you want to see an error message if the program does change it, use a constant.

Personally, I use variables for everything. That's just my style.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,135
Messages
2,570,783
Members
47,339
Latest member
flaviu2

Latest Threads

Top