Home >Web Front-end >JS Tutorial >There is an interesting piece of code - javascript realizes multi-line information_javascript skills

There is an interesting piece of code - javascript realizes multi-line information_javascript skills

WBOY
WBOYOriginal
2016-05-16 19:09:30796browse

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn