Skip to content

Science

Module to generate science related entries.

Overview

Both methods in this module return objects rather than strings. For example, you can use faker.science.chemicalElement().name to pick out the specific property you need.

chemicalElement

Returns a random periodic table element.

Available since v7.2.0

Returns: ChemicalElement

ts
function chemicalElement(): ChemicalElement;

Examples

ts
faker.science.chemicalElement() // { symbol: 'H', name: 'Hydrogen', atomicNumber: 1 }
faker.science.chemicalElement() // { symbol: 'Xe', name: 'Xenon', atomicNumber: 54 }
faker.science.chemicalElement() // { symbol: 'Ce', name: 'Cerium', atomicNumber: 58 }

unit

Returns a random scientific unit.

Available since v7.2.0

Returns: Unit

ts
function unit(): Unit;

Examples

ts
faker.science.unit() // { name: 'meter', symbol: 'm' }
faker.science.unit() // { name: 'second', symbol: 's' }
faker.science.unit() // { name: 'mole', symbol: 'mol' }

Released under the MIT License.