mardi 25 août 2020

From Api, how to call the data that include the certain string?

I'm the super beginner of Javascript, and the question might be too easy for you.

I have encountered an issue regarding calling the data from API.

When you call a certain data from the description from an API, how would you code to call the information that contains a certain piece of string?

For example, I attempt to call information from the description that includes the string "rain".

            console.log()
            if (data.description === "rain") {
                weatherIcon.className = "wi wi-day-rain"
            } else {
                weatherIcon.className = "wi wi-day-sunny"
            }

I super appreciate in advance.

Aucun commentaire:

Enregistrer un commentaire