Home > Article > Web Front-end > There is an interesting piece of code - javascript realizes multi-line information_javascript skills
Function.prototype.getMultiLine = function() {
var lines = new String(this);
lines = lines.substring(lines.indexOf("/*") 3, lines.lastIndexOf("*/" ));
return lines;
}
var ffff = function() {
/*
Zhang San went to pour water
Oh my God!
*/
}
document.write(ffff.getMultiLine());
Haha, if you use js to write exp or other text that is needed This is very useful