JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" id="str" placeholder="Введите строку">
<button>Узнать</button>
<h1>Результат</h1>

CSS

h1 {
  padding: 3px;
  border: 1px solid #ccc;
  text-align: center;
}

JavaScript

const big = (str) => {
  let sp ='';
  sp = sp + toUpperCase(str[0]);
    for (let i = 1; i < length(str); i += 1 ) {
    if ( str[i] !== '' && str[i-1]==='') {
      sp = sp + toUpperCase(str[i]);
    }else{
    sp = sp + str[i];
    }
  }
return sp;
}

var button = document.getElementsByTagName('button')[0],
  out = document.getElementsByTagName('h1')[0],
  str = document.getElementById('str');

button.addEventListener('click', function() {
  // call function and out result to DOM element
  out.innerHTML = solution(str.value);
});