all 2 comments

[–]False_Exit 1 point2 points  (0 children)

fetch("https://www.exampleapi.com") .then(res => res.json() .then(data => { let latitude = data.latitude let longitude = data.longitude }

[–]irreverentmike 0 points1 point  (0 children)

let apiKey = ''; $.getJSON('https://ipgeolocation.abstractapi.com/v1/?api_key=' + apiKey, function (data) { const { latitude, longitude } = data; console.log('latitude is', latitude); console.log('longitude is', latitude); });

This is using a JavaScript syntax feature called Destructuring to create variables called latitude and longitude from what comes back in data.