Practice
JavaScriptData StructuresReactConcepts
Sign in
← Back to problems

Getter Property

Object-Oriented Programmingmedium

Course · Section 14: Object-Oriented Programming (OOP) With JavaScript · Lecture 226: ES6 Classes

Define a `Person` class with a `fullName` getter, and implement `fullNameOf(first, last)` returning the full name.

Sample tests

Input: fullNameOf("Ada", "Love")
Output: "Ada Love"
Input: fullNameOf("A", "B")
Output: "A B"

+ 1 hidden test run on Submit.

Hints

Common pitfalls
  • Calling a getter like a method (fullName()) fails.

Learning resources

  • MDN: Classes
Visualize this concept: Getters and Setters →
Approach & explanation (try first)

A getter computes a value accessed as a property, here joining first and last names.

Loading...
⌘/Ctrl + Enter

Run your code to see results.