Ternary recursive function in javascript : I've seen this function, cause i'm trying to convert xml to json, but i need to modify some stuff on the fly.
So i wanna convert this function as a "if/else" or a loop.

Could you help me ?

    function xmlToJson(xmlNode) {
        return {
            text: xmlNode.firstChild && xmlNode.firstChild.nodeType === 3 ? 
                  xmlNode.firstChild.textContent : '',
            children: [...xmlNode.children].map(childNode => xmlToJson(childNode))
        };
    }