CodePudding user response:
Window. The code is really err==function () {}?The==comparison operator, is a window. The err function with a newly created empty anonymous function () {} are equal, (note that is newly created,
In js functions, arrays, objects are by reference address comparison,
Even if Windows. Err is an empty anonymous function function () {} with the newly created this empty anonymous function function () {} is not equal,
Because the two reference address is different, is not the same function,
Unless the window. The value is a string of err "function () {}",
"Function () {}" and the function () {} comparison function () {} will be converted to "function () {}" to compare,
Into two strings "function () {}" and "function () {}", result can be true,