Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

175
Visualizações
What does !+ (not plus string) mean in JavaScript?

What does !+ (exclamation mark addition) mean in JavaScript?

Why is !+"000" true?
Why is !+"0010" false?

Tries:

!+"000" // true
!+"00010" // false
!+"0a0" // true
!+"0,0" // true
!+[0,0,0] // true
!+[0,1,0] // true
true+"000" // true000

I've tried to search:

  • In JavaScript, why is "0" equal to false, but when tested by 'if' it is not false by itself?
  • What does "!--" do in JavaScript?
  • What is the !! (not not) operator in JavaScript?

Here I saw the code: JS - Check if string contain only 0

This information is hard to find on the Internet.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

+ is unary plus. It'll convert the expression that follows to a number.

Then, ! negates the expression that follows: if it's truthy, the result is false. If it's falsey, the result is true.

A couple of examples:

!+"000"
!0 // because '000', when converted to a number, is 0
true

!+"00010"
!10 // because "00010", when converted to a number, is 10
false // because 10 is truthy

!+[0,1,0]
!NaN // because arrays can't be converted to numbers directly (usually)
true
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda