📅  最后修改于: 2022-03-11 14:53:29.790000             🧑  作者: Mango
const str = `
1st p tag
2nd p tag
`
let doc = new DOMParser().parseFromString(str, 'text/html')
console.log(
doc.querySelector('p').textContent
)