Physics.constant

Returns an object describing a physical constant which name matches the search string.

Syntax

constant(searchString)

Parameters

Return value

If the search string matches a constant name exactly or there is only one result matching the string, the object describing the constant is returned.

The object contains the following properties:

If the search string matches multiple constant names or there were no constants found, throws an error.

Examples

Physics.constant("proton mass")
{
  name: "proton mass",
  value: 1.67262192369e-27,
  unit: "kg",
  uncertainty: 5.1e-37
}
Physics.constant("compton wavelength").value
2.42631023867e-12
Physics.constant("mass")
Error: multiple candidates found for "mass": ...
Physics.constant("ufo")
Error: no constants found for "ufo"

See also