Это мой код:
window.addeventlistener (‘load’, () => {let long;//долгота: let lat;//latitude; let.queryselector (‘. ;
//if location exist in browser
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(position => {
long = position.coords.longitude;
lat = position.coords.latitude;
let proxy = 'https://cors-anywhere.herokuapp.com/';
//Dark Sky API --- api key is in api address after forecast/
//on the end of api change numbers for longitude & latitude in variable
const api = '${proxy}https://api.darksky.net/forecast/09e239664b0eb3d9ee3f2e5e9463217a/${lat},${long}';
// fetch extract info from const api
fetch(api)
// return fetch data to Json
.then(response => {
return response.json();
})
.then(data=>{
const {temperature, summary } = data.currently;
});
});
}
});
Оригинал: “https://dev.to/ivkemilioner/i-can-t-find-where-is-error-syntaxerror-json-parse-unexpected-character-at-line-1-column-1-of-the-json-data-4g5i”