What mean exclamation marks?

$(function() {$("body")
 .on("input propertychange", ".form-item",function(e) {
 $(this).toggleClass("form-item-outer",!! $(e.target).val());})
 .on("focus", ".form-item",function() {
$(this).addClass("form-item-focused");})
 .on("blur", ".form-item",function() {
$(this).removeClass("form-item-focused");});
});
July 2nd 19 at 13:53
4 answers
July 2nd 19 at 13:55
Solution
This conversion to boolean, i.e. the following
!! variable
meaning meets here this:
Boolean(variable)
July 2nd 19 at 13:57
Solution
double negative.
!! false => false
!! true => true
!! "=> false
!! 'some text' => true


First ! converts the value after the Boolean and returns true if possible, otherwise false, the second ! denies the resulting.
July 2nd 19 at 13:59
Double negative

Cast to bool
July 2nd 19 at 14:01
here asked this question

Find more questions by tags JavaScriptjQuery