Here I have an http call which reminds me of an array of "Favorite" objects of size 1 (it is impossible for the call to have more than 1 result). How can I get just the object instead of the array and assign the value to my idFav? (in my code idFav is undefined)
removeFav(movie:Movie){
let idFav;
let idUtente = this.authSrv.getUserId();
this.http.get<Favorite>(`${this.baseURL}/favorites?
userId=${idUtente}&movieId=${movie.id}`).subscribe((val)=>{
idFav = val;
console.log(val); // array of 1 obj
})
console.log(idFav) // undefined
}