开发者

what is this annotation in jquery validator plugin line 86

开发者 https://www.devze.com 2023-04-11 16:06 出处:网络
hi i am using jquery validator plugin , i saw annnotation like this = what does this mean , i have never seen like that ,

hi i am using jquery validator plugin , i saw annnotation like this

|=

what does this mean , i have never seen like that ,

this is code

// http://docs.jquery.com/Plugins/Validation/valid
valid: function() {
if ( $(this[0]).is('form')) {
    return this.validate().form();
} else {
    var valid = false;
    var validator = $(this[0].form).validate();
    this.each(function() {
            valid |= validator.开发者_Go百科element(this);
    });
    return valid;
}

},

please help....................


var1 |= var2;

is the same as

var1 = var1 | var2;

| is the bitwise OR operator

https://developer.mozilla.org/en/JavaScript/Reference/Operators/Bitwise_Operators

Some examples of ORing numbers:

1 | 1 => 1
1 | 2 => 3
1 | 3 => 3    
1 | 4 => 5


It's a BitWise OR assignment operator

Similar to doing x = x | y, it's the shorthand of that, x |= y

Reference: https://developer.mozilla.org/en/JavaScript/Reference/Operators/Assignment_Operators

0

精彩评论

暂无评论...
验证码 换一张
取 消