Write a program that outputs an English word consisting of uppercase letters by replacing all ‘A’ in the word with ’#‘.
A string is entered in the first line.
BANANA
Prints the changed word on the first line.
B#N#N#
for ... of
function solution(s) {
let answer = '';
for (let x of s) {
if (x === 'A') answer += '#';
else answer += x;
}
return answer;
}
regex
function solution(s) {
return s.replace(/A/g, '#');
}