Update -(更新-)
If you still need a method to do that, try this regex
pattern(如果您仍需要执行此操作的方法,请尝试以下regex
模式)
function capitalize(value){ return value.replace(/(?:^|\s|-)\S/g, x => x.toUpperCase()); } console.log(capitalize('hello i misunderstood your requirement initially by skipping the whole description'))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…