0
// js code, when I add twice or more only the last div is created
function Adicionar (nome) {
    
    window.onload = init;
    function init(){
        new CriarElementos();
        function CriarElementos() {
            var NovaDiv = document.createElement('div');
            var NovoH1 = document.createElement('h1');
            var TextoH1 = document.createTextNode(nome);
            NovaDiv.id = 'MeuId';
            NovaDiv.classList.add('margem');
            NovoH1.appendChild(TextoH1);
            document.getElementById('novos').appendChild(NovaDiv);
            document.getElementById('MeuId').appendChild(NovoH1);
        }
    }
}
var objeto =  new Adicionar('Pão');
var objeto2 =  new Adicionar('Leite');
						
I’ll test thank you
– Vinicius_o_programador