Find the temperature closest to 0
JavaScript (ES6), 33 bytes

a=&gt;a.reduce((m,n)=&gt;n*n-n&lt;m*m?n:m)


Demo



let f =

a=&gt;a.reduce((m,n)=&gt;n*n-n&lt;m*m?n:m)

console.log(f([1, -2, -8, 4, 5]))