Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Practice: The toString Version of You

From: Nashville Software School

Create an object that represents you. It should have the following properties on it.

  1. First name
  2. Last name
  3. Date of birth
  4. Place of birth
  5. Current city of residence
  6. Current state of residence

Only the city and the state of residence should be able to be modified by other code in the application. The other properties should be read only (i.e. non-writable).

Once those are defined, create a method on your object named toString().

const Me = Object.create(null, {
    toString: {
        value: function () {
            // Your code goes here

When you invoke the toString() method, the following string should be generated.

Ollie Osinusi was born in Sacramento, CA. He was born on 10/13/1990. He currently lives in Murfreesboro, TN.
You can’t perform that action at this time.