1var htmlString= "<div>\n <h1>Hello World</h1>\n <p>This is the text that we should get.</p>\n <p>Our Code World © 2017</p>\n </div>";
2
3var stripedHtml = htmlString.replace(/<[^>]+>/g, '');
4var decodedStripedHtml = he.decode(stripedHtml);
5
6// Hello World
7// This is the text that we should get.
8// Our Code World © 2017
9console.log(stripedHtml);
10
11// Hello World
12// This is the text that we should get.
13// Our Code World © 2017
14console.log(decodedStripedHtml);