function solution(str){ const regex = /A/gi; return str.replace(regex, "#"); } let str = "BANANA"; console.log(solution(str));