πŸ“š Reference


πŸ”– Index


replace()


var newStr = str.replace(regexp|substr, newSubstr|function)

전체 λ¬Έμžμ—΄ λŒ€μ²΄ν•˜κΈ°


1. replace + μ •κ·œν‘œν˜„μ‹

const str = 'dog dog test dog hello hi';

str.replace(/dog/gi, 'monkey');
// "money monkey test monkey hello hi"

2. split(), join() μ‚¬μš©