每日一个lodash方法之eq

eq方法遵守SameValueZero规范

每日一个lodash方法之eq_第1张图片

 ===遵守Strict Equality Comparison规范

每日一个lodash方法之eq_第2张图片

回到eq源码value === other || (value !== value && other !== other),value===other遵守Strict Equality Comparison规范,而Strict Equality Comparison规范和SameValueZero的差异在于NAN上故在value===other上加上value和other同为NAN的情况。

 

该文章参照https://www.cnblogs.com/hefty/p/8190969.html

你可能感兴趣的:(前端)