Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Salesforce JS-Dev-101 Exam - Topic 5 Question 10 Discussion

Posted by Willard on Jun 16, 2026 at 08:50 PM

Refer to the following object:

const dog = {

firstName: 'Beau',

lastName: 'Boo',

get fullName() {

return this.firstName + ' ' + this.lastName;

}

};

How can a developer access the fullName property for dog?

Suggested Answer: A

The correct answer is A.

This object uses a getter:

get fullName() {

return this.firstName + ' ' + this.lastName;

}

A getter looks like a method when it is defined, but it is accessed like a normal property.

So the correct access syntax is:

dog.fullName

That returns:

'Beau Boo'

The important distinction is:

dog.fullName

not:

dog.fullName()

Because fullName is a getter property, not a regular function property.

Option B is incorrect because calling dog.fullName() tries to call the returned string as a function. Since 'Beau Boo' is not a function, that would cause a TypeError.

Option C is incorrect because there is no get object inside dog.

Option D is incorrect because there is no function object inside dog, and getters are not accessed that way.

Therefore, the verified answer is A.


Get Premium JS-Dev-101 Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
12 comments · newest first
TA
Tabetha 2 months ago
Yeah, A) makes sense. The syntax is clean and simple.
DI
Diane 2 months ago
Agreed! A) dog.fullName is the right choice. It's a getter.
AL
Alba 2 months ago
I think it's A) dog.fullName. Looks straightforward.
LA
Lawana 2 months ago
I thought it would be more complicated than that.
MA
Margart 3 months ago
B) dog.fullName() doesn't work, it's a getter!
RE
Reiko 3 months ago
Wait, is it really that simple?
FI
Filiberto 3 months ago
Totally agree, that's the way to do it!
MI
Mila 3 months ago
A) dog.fullName is correct!
GR
Gracia 3 months ago
I’m leaning towards A too, but I keep second-guessing myself about whether I should use parentheses or not.
LE
Lemuel 4 months ago
I feel like it could be tricky; I want to say A, but what if there's something I'm missing about getters?
SA
Salley 4 months ago
I remember practicing a question like this where we accessed a property directly. A seems right to me.
LA
Lashandra 4 months ago
I think the answer might be A, but I'm not completely sure if I need to call it like a function.
0/2000 characters

Save Cancel