在尝试修复另一个人的代码中的错误时,我发现了这一行:
affiliationData.affiliationStatuses |= AffiliationStatuses.affiliatedWithCurrentCrmUser;
它实际上做了什么?
试图在MDN上找到它,但是searching for |= returns zero results。
答案 0 :(得分:4)
答案 1 :(得分:3)
答案 2 :(得分:2)
`x |= y`
是简写
x= x|y
其中|
是bitwise OR
因此
affiliationData.affiliationStatuses |= AffiliationStatuses.affiliatedWithCurrentCrmUser;
相当于:
affiliationData.affiliationStatuses = affiliationData.affiliationStatuses | AffiliationStatuses.affiliatedWithCurrentCrmUser;