Skip to content

isNegative

A função isNegative verifica se um número é negativo.

Sintaxe

typescript
isNegative(value)

Parâmetros

ParâmetroTipoDescrição
valuenumberNúmero a ser verificado.

Retorno

Retorna true se o número for negativo, caso contrário retorna false.

Exemplos

typescript
isNegative(-5); // true
isNegative(0);  // false
isNegative(10); // false

Notas

  • Lança um TypeError se o valor não for um número.
  • Útil para validações matemáticas e lógicas.

Referências

Released under the MIT License.