Use of Bracket Notation

Tell us what’s happening:
Describe your issue in detail here.
The “Bracket” used in this challenge ought to be explained as ‘SQUARE BRACKET’ to differentiate it from other types of brackets or parentheses. Due to this confusion I spent 7 days to complete this challenge.
Thank you.

Your code so far


// Setup
let firstLetterOfLastName = "";
const lastName = "Lovelace";

// Only change code below this line
firstLetterOfLastName = lastName; // Change this line

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36

Challenge: Use Bracket Notation to Find the First Character in a String

Link to the challenge:

Perhaps, but “bracket notation” is what JS calls it. And there was the example code:

const firstName = "Charles";
const firstLetter = firstName[0];

I think that makes it clear what kind of brackets they wanted. I would suggest reading more closely. In the professional coding world. A lot of things are not explained explicitly and have to be inferred from code.

The in the US (primarily where this was built), they can be called “square brackets” but are also often just called “brackets”. For example, the MDN article makes no mention of “square”.

But I get that people from other parts of the world may have different words for things. If you feel strongly about it, you can always start an issue on the repo.

I appreciate your response, Kevin.
Earlier on I did not take into account the differences in types of brackets. Since the observation is already noted at FreeCodeCamp.com I am relieved.
Many thanks.
Edmund.

1 Like

Always use the square one when it comes to singling out positions of something like [3] the fourth item/letter etc.

The syntax is shown twice in the challenge. I don’t see how the wording can change that fact.

you can get the value of the first letter of the string by using firstName[0]

const firstLetter = firstName[0];

It even says to look at the example code if you get stuck.

1 Like

Oh yeah! The wording would affect it because ‘parentheses ( )’ bracket offers a different function from a ‘square bracket. You may wish to try both to ascertain this. As I said earlier, Kevin Smith’s explanation satisfied my initial observation.
Edmund.

There is no room for interpretation here because the syntax you have to use is literally shown to you in two different places.

Why do you think it is showing you twice to use [] if it was up to interpretation?

I fail to understand how your interpretation of what brackets mean would make you ignore the code syntax shown in the examples.

I think it just takes a little time for it to click for some people about how much attention you have to pay to detail. But it is very important in this type of work.

Precisely so, Kevin.
Nothing more to add.
Edmund

If you check the image on the right, with the different brackets distinguished in common naming, you will notice that square brackets are also commonly called simply brackets, while other types of brackets tend to be specified. Also, the first thing that came to me when I googled “brackets” is an image of square brackets. The challenge itself, does use only square brackets in its examples, so I find it very odd to be misled on what type of brackets one has to use(take it from a non-native english speaker, who made almost no destinguishing between words like brackets and parenthesis, back when I was solving this challenge for the first time).

Hmm, this may be the source of the confusion:

In most English-speaking countries, an unqualified ‘bracket’ refers to the round bracket; in the United States, the square bracket.

Programming tends to follow US English language conventions, as opposed to British English.

This table in Wikipedia is pretty good reference for the terms you’ll see in programming:

Shape ( ) [ ] { } ⟨ ⟩
Full name Round brackets Square brackets Curly brackets Angle brackets
Short name parentheses brackets braces chevrons

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