SOURCE

const shapeType = {
  triangle: Symbol()
};

function getArea(shape, options) {
  let area = 0;
  switch (shape) {
  case shapeType.triangle:
    area = .5 * options.width * options.height;
    break;
  }
  return area;
}

let myArea = getArea(shapeType.triangle, {
  width: 100,
  height: 100
});
console.log("getArea = " + myArea);
console 命令行工具 X clear

                    
>
console