【发布时间】:2020-10-18 23:54:15
【问题描述】:
我有这个挑战:
var tx = "<p>This is a sample picture. <img src="" alt="Sample picture"> This picture is the best for the advertising...</p> ";
如何格式化这个变量来去掉img标签并得到结果:
tx = "<p>This is a sample picture. This picture is the best for the advertising...</p> ";
【问题讨论】:
-
你考虑过使用正则表达式吗?
-
tx.replace(/.../, ''),使用正则表达式。 developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…
标签: javascript node.js