Fieldset » elements

elements() → array

Retrieve the entries of this fieldset as Field elements (instead of their direct values) in sequential order. This seamlessly lets you switch from associative readout to sequential readout, allowing fieldsets to also represent document-like structures instead of just associative data.

enopreferences:
alice = icetea
bob = peppermint tea
jane = no tea at all
ann = earl grey
javascriptconst document = eno.parse(input);
const preferences = document.fieldset('preferences');

let html = '<h1>Observe these fascinating tea preferences, presented in html!</h1>';

for(let element of preferences.elements()) {
  html += `<strong>${element.name}</strong> likes ${element.value()}.<br>`;
}

fs.writeFileSync('index.html', html);

Return value

An array containing the elements of this section.