使用从对象获取的参数创建一个元素-JavaScript

我想创建一个从数组获取数据并在HTML +适当参数中创建适当标签的函数。当有多个参数时,就会发生此问题。

Creation logs IMG

它们形成但不是仅一起形成。

var elem = [[
    // <div class"container"></div> //Example
    ["div", "container"],
    ["form", {method: "POST", name: "contant"}], //Two objects (arguments for html)
    ["div", "box"]
]];
class Form {
    constructor(index) {
        this.index = index;
    };

    createField() {
        for(const marker of elem[this.index]) {
            if(marker[1] instanceof Object) {
                for(var test of Object.keys(marker[1])) {
                    console.log(this.createElement(marker[0], {
                        [test]: marker[1][test]
                    }));
                }
            } else { //If there is no object, it adds a class
                var key = 'class';
                var value = marker[1]
                console.log(this.createElement(marker[0], {
                    [key]: value
                }));
            }
        };
    };

    createElement(elementName, attributes) {
        this.element = this.createElement.call(document, elementName);

        if(attributes && !(attributes instanceof Object)) {
            throw Error('Error attributes');
        } else if(attributes) {
            for(const attr of Object.keys(attributes)) {
                this.element.setAttribute(attr, attributes[attr]);
            };
        };
        return this.element;
    };

我想使它具有这两个参数,而不是从一个参数创建两次