Molecule.getAtomById

Arguments

let molecule = new Molecule();

molecule.getAtomById(id /* type: String */);

Returns

Type: Atom Instance

The function returns an instance of the corresponding Atom.

Interactive Example

const { Molecule } = require('mcul'); let molecule = new Molecule(); let hydrogen = molecule.createAtom('H'); let id = molecule.getAtomId(hydrogen); hydrogen = molecule.getAtomById(id); console.log(hydrogen);