0

console screenshot

Guys,i am using this public api to fetch its "city" field,api is returning me status("ok"/"fail") and an array named result which further has -lastname,country ,city etc within it.

I wish to pick data from "city" given in the array[0] from the array[0] and array1 which this api is fetching for me. How to fetch city? i used this- js code screenshot

heres my html tag where i wish to display the city i am getting from api html code screenshot

its my first time posting query,sorry for hotch potch

newbie
  • 1
  • 2

1 Answers1

0

Try this instead:

let city = data.result[0].city;
kingkong.js
  • 659
  • 4
  • 14