Код: Выделить всё
const str = "This is very long road"
const newChar = {
s: "S",
o: "O"
};
let newStr = "";
for (const char of str){
newStr += newChar[char] || char;
}
console.log(newStr);
< /code>
может кто -нибудь объяснить мне, что означает этот код? < /p>
newChar[char] || charне можем ли мы просто написать newchar ?
Подробнее здесь: https://stackoverflow.com/questions/796 ... javascript
Мобильная версия