Please help. about Fetch async await

hi. i been struggle about this api things few days and i can’t understand much even tho i search about it. can some one please explant about the code block. English is not my first languages so… please if you can explain very simple. Also i try to get API from the I know there is something wrong about the last code block but i can’t help to resolve. Thank you.

const apiKey ="xxxxxxxxxxxxxxxxxxxxxxxxx";
const url = "";
const queryParams ="&appid="

//get elements
const inputValue = document.getElementsByClassName('input');
const submitButton = document.getElementsByClassName('btn'),
  cityName = document.getElementById("city-name"),
  icon = document.getElementById("icon"),
  temperature = document.getElementById("temp"),
  humidity = document.getElementById("humidity-div");

// Place to put the input value
function enterPressed(event) {
    if (event.key === "Enter"){

//The press button function
function findWeatherDetails(){
    if (inputValue.value === ""){

    } else {
        let searchLink = url + inputValue.value + queryParams + apiKey;
          getWeather(searchLink, theResponse);
function theResponse(response){
    let jsonObject = JSON.parse(response);
    cityName.innerHTML =;
    icon.src = "" +[0].icon + "png";
    temperature.innerHTML = searchLink + "&units=metric";
    humidity.innerHTML = jsonObject.main.humidity + "%";
async function getWeather(searchLink, callback) {
   const response = await fetch(searchLink, {cache: 'no-cache'})
         const jsonResponse = await response.json();
    } catch(error){

Are you getting any errors? or is the code not doing what you expected?

async and await are keywords used when you work with functions that need time to work. The function “getWeather” has to fetch the information. This takes time. So you use await to tell your program to wait until fetch is finished before moving to the next step, which in this code is the if (response.ok)

Have you tried reading about Asynchronous JavaScript? Asynchronous JavaScript - Learn web development | MDN

so when i enter the value it not return anything. i try to see the console and it write error. can you tell am i missing some code so that code not working?? thank you