Create a string of variable length, filled with a repeated character

前端 未结 10 1096
刺人心
刺人心 2020-11-28 03:59

So, my question has been asked by someone else in it\'s Java form here: Java - Create a new String instance with specified length and filled with specific character. Best so

10条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-28 04:53

    Give this a try :P

    s = '#'.repeat(10)
    
    document.body.innerHTML = s

提交回复
热议问题