We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 92fa95e commit f756172Copy full SHA for f756172
1-js/02-first-steps/12-nullish-coalescing-operator/article.md
@@ -102,7 +102,7 @@ alert(altura ?? 100); // 0
102
- `altura || 100` verifica se `altura` é um valor avaliado como falso, e de fato é.
103
- então o resultado é o segundo argumento, `100`.
104
- `altura ?? 100` verifica se `altura` é `null/undefined`, e não é,
105
- - então o resultado é o valor atual de `altura`, que é `100`.
+ - então o resultado é o valor atual de `altura`, que é `0`.
106
107
Se altura igual a zero é um valor válido que não deve ser substituído pelo valor padrão, então usar `??` é o correto.
108
0 commit comments