The JavaScript implementation stores an example of an HTML string

  • 2020-03-30 02:39:51
  • OfStack

I'm in PHP. It reminds me. < < Syntax (heredoc and nowdoc), so name him heredoc.
 
Function.prototype.heredoc = function(){ 
//The function annotation is used to store strings without escaping.
var _str = this.toString(), 
s_pos = _str.indexOf(""); 
return (s_pos<0 || e_pos<0) ? "" : _str.substring(s_pos, e_pos); 
} 

function fn(){ 
/*<table> 
<tr> 
<td> The user name </td> 
<td> password </td> 
</tr> 
<tr> 
<td style="widht:20px;">@name</td> 
<td>zf123456</td> 
</tr> 
</table>*/ 
} 

var str_table = fn.heredoc(); 
console.log(str_table); 

Related articles: