If you find yourself need to iterate through some tags in vanilla Javascript you can use:
const divElements = document.querySelectorAll('div');
divElements.forEach(dv => {
const query = dv.textContent.trim();
const displayType = dv.getAttribute('display') || 'table'; // Default to 'table'
});
You could also use something like:
Array.from(divElements).forEach(dv => {
const query = dv.textContent.trim();
const displayType = dv.getAttribute('display') || 'table';
dv.style.display = (displayType === 'table') ? 'block' : 'inline';
});
Which is just a little different overall in syntax and function and converts an object into an Array.