Criei uma função em javascript, porem me retorna o seguinte erro: Cannot read property 'value' of null Segue um pedaço do código: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> function defineLetrar() { var obj; for (var i = 0; i <= 10; i++) { let obj = document.getElementById(`letra${i}`).value = '' console.log(obj) //obj = document.getElementById('letra'+i).style.display = 'none'; } } <!-- language: lang-html --> <input type="text" name="" id="letra1" class="input-text" maxlength="1" disabled> <input type="text" name="" id="letra2" class="input-text" maxlength="1"> <input type="text" name="" id="letra3" class="input-text" maxlength="1"> <input type="text" name="" id="letra4" class="input-text" maxlength="1"> <input type="text" name="" id="letra5" class="input-text" maxlength="1"> <input type="text" name="" id="letra6" class="input-text" maxlength="1"> <input type="text" name="" id="letra7" class="input-text" maxlength="1"> <input type="text" name="" id="letra8" class="input-text" maxlength="1"> <input type="text" name="" id="letra9" class="input-text" maxlength="1"> <input type="text" name="" id="letra10" class="input-text" maxlength="1"> <!-- end snippet -->