Practice
JavaScriptData StructuresReactConcepts
Sign in
← Back to problems

Object.create

Object-Oriented Programmingmedium

Course · Section 14: Object-Oriented Programming (OOP) With JavaScript · Lecture 229: Object.create

Using `Object.create` with a prototype that has a `describe()` method, implement `describeValue(value)` returning the string `value=` followed by the value.

Sample tests

Input: describeValue(5)
Output: "value=5"
Input: describeValue(0)
Output: "value=0"

+ 1 hidden test run on Submit.

Hints

Common pitfalls
  • Object.create(proto) does not run a constructor; set properties yourself.
Visualize this concept: Prototypes and Inheritance →
Approach & explanation (try first)

Object.create makes a new object whose prototype is the given object, inheriting describe.

Loading...
⌘/Ctrl + Enter

Run your code to see results.