Javascript examples for String Operation:String Convert
Efficient way to create an N-times-a-character string
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from ww w. ja v a 2 s . c o m*/ String.prototype.repeat = function (len) { return (new Array(len + 1)).join(this); } console.log('-/'.repeat(5)); } </script> </head> <body> </body> </html>