Group a related function under a namespace object.

Namespace Method

namespace_method.js
const amount = 4;
const total = {
  addTax(value) {
    return value + 2;
  },
}.addTax(amount);

console.log("amount=" + amount);
console.log("total=" + total);
namespace-method A namespace object groups related operations under one name. This chapter uses object-namespace style so the trace can stay in one source file.