let str = "abcdefg";
let newStr = "";
for (let i = 0; i < str.length; i++) {
if ((i + 1) % 3 !== 0) {
newStr += str[i];
}
}
console.log(newStr);
Или:
let str = "abcdefg";
let newStr = [...str].filter((_, index) => (index + 1) % 3 !== 0).join("");
console.log(newStr);