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