Alexsandr,
"use strict"
const bigword = (str) => {
let result = "";
for (let i = 0; i < str.length; i++){
if ( i === 0 || str.charAt(i) !== " " && str.charAt( i - 1 ) === " " ) {
result += str[i].toUpperCase();
} else {
result += str.charAt(i);
}
}
return result;
}
alert(bigword(" привет тест"));