+ 1

Знак "!" и "return" в "if"

var resu21 = document.getElementById('r1'); if (!resu21) return; Как работает вторая строка?

17th Mar 2017, 5:40 AM
Марсель Муртазин
Марсель Муртазин - avatar
1 Resposta
+ 1
"if(!resu21)" means "if not resu21", which is equivalent to "if resu21 is false". This will apply if resu21 happens to be an empty string.
17th Mar 2017, 6:24 AM
Álvaro