bhylu.com

Advertisements

Function Reference

Functions are values with properties and invocation methods. Their length counts parameters before the first default or rest parameter.

Where to run this

This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.

A practical example

JavaScript

function book(name, count = 1) { return {name, count}; }
console.log(book.name);
console.log(book.length);

What happens

The function name is book and its length is 1.