-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWhereIsSpaceStation.js
More file actions
26 lines (22 loc) · 857 Bytes
/
WhereIsSpaceStation.js
File metadata and controls
26 lines (22 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const lat = document.getElementById("lat")
const lon = document.getElementById("lon")
const alt = document.getElementById("alt")
const vel = document.getElementById("vel")
const getSpaceStationData = async () => {
try {
const response = await fetch("https://api.wheretheiss.at/v1/satellites/25544")
// console.log(response)
const { latitude, longitude, velocity, altitude } = await response.json();
// console.log(latitude)
// console.log(longitude)
// console.log(altitude)
// console.log(velocity)
lat.innerHTML = latitude.toFixed(5);
lon.innerHTML = longitude.toFixed(5);
alt.innerHTML = altitude.toFixed(0);
vel.innerHTML = velocity.toFixed(0);
} catch (error) {
console.log(error)
}
}
const interval = setInterval(getSpaceStationData, 1000)