const content = `<bode><div style=" padding:1px">12 3</div></bode>` function replaceHtml(content) { const str = content const arr = [...content] const start = arr.findIndex(item => item === '<') const end = arr.findIndex(item => item === '>') let tag = arr.slice(start, end + 1) const item = { tag: tag } } replaceHtml(content)