You could pass the value as a param and check the value is present or not with condition
function getData(val) { // param
let getSearchInput = val ? val : document.getElementById("search-input").value;
fetch(`https://pokeapi.co/api/v2/pokemon/${getSearchInput}`)
.then((response) => response.json())
.then((data) => {
.....
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…