r/learnjavascript • u/somethingsilver97 • Feb 11 '26
Can some explain this?
I'm taking a class that includes beginners Javascript. I got this question in a practice quiz. Couldn't all of the options be correct? What did I misunderstand?
Question: How are objects declared and initialized in JavaScript?
- Using the reserved word var followed by an identifier and an equal sign and the pairs label: value of the elements between curly brackets and separated by commas
2.Using the reserved word function followed by an identifier and an equal sign and the pairs label: value of the elements between curly brackets and separated by commas
3.Using the reserved word let followed by an identifier and an equal sign and the pairs label: value of the elements between curly brackets and separated by commas
4. Using the reserved word const followed by an identifier and an equal sign and the pairs label: value of the elements between curly brackets and separated by commas
View all comments
Show parent comment
1
u/Hehosworld Feb 15 '26
Here's an important learning you can take from this interaction. Especially if you manage IT specialists one day. Programmers are often very effective communicators. That also means they are very direct which can be daunting. But they will tell you specifically which information they need. In this case it is about ambiguity of natural language. The goal was that you restate the question writing the examples as code.
Programmers need to be very exact with how they communicate, their primary job is to communicate their ideas to a computer and computers are not really good with ambiguous information.