jskatas.org Continuously Learn JavaScript. Your Way.

function API: function.prototype

The prototype property of a function is an object that is used to implement inheritance and shared properties.

The prototype property - the place to add shared functionality

WHEN defining the prototype on a function THEN the instance of that function inherits these properties
const fn = function() {} fn.prototype = { solution: 42, }; const obj = new fn(); assert.equal(obj.solution, 42);


The very first version of the spec defines this property already, the ES1 spec, see section (PDF 732kB).

Related Katas

function API

Arrow functions

Async Function

Difficulty Level



1 tests to solve