This is the code:-
async function helper(){
    const url = "https://api.wheretheiss.at/v1/satellites/25544"
    const result = await fetch(url)
    const data = await result.json()
    return data
}
function get_iss_data(){
    helper().then(function(result) {
        console.log(result)
        return result
     })
}
const iss_data = get_iss_data()
console.log(iss_data)
Result:-
PS C:\Users\rohit\Desktop\books\NASA> node "c:\Users\rohit\Desktop\books\NASA\js\sidebar.js"
undefined
(node:23144) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
{
  name: 'iss',
  id: 25544,
  latitude: 21.630682055727,
  longitude: 150.5209960191,
  altitude: 417.75348313675,
  velocity: 27585.744913028,
  visibility: 'eclipsed',
  footprint: 4496.0164865017,
  timestamp: 1664538467,
  daynum: 2459852.9915162,
  solar_lat: -2.900540504218,
  solar_lon: 0.55516581402854,
  units: 'kilometers'
}
There are two console.log(), one in the function other at the end of the function.
console.log inside the function is working fine but I cannot save to response in iss_data variable.
Thanks in advance.
 
    