The javascript implementation stores the HMTL string example

  • 2020-03-30 02:45:56
  • OfStack


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>*/
}
varstr_table=fn.heredoc();
console.log(str_table);


Related articles: