Number.sign() in javascript June 7, 2023 by Tarik More elegant version of fast solution: var sign = number?number<0?-1:1:0