I have some typescript code that reads 5 players from a text file. The problem is I am unable to remove the word "player - " from all of them?
Example of the text file:
player - toby
player - coby
player - roby
player - poby
player - boby
Here is the code I wrote:
const players = fs
.readFileSync(`${__dirname}/db/players.txt`, {
encoding: 'utf8',
flag: 'r',
})
.toString().replace('player - ',"")
.split('\n');
but it only is replacing for one person?