Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Interesting, I would have never thought the js interpreter would interpret both as being === even though the two functions are different.


The two functions are different, but their return values are identical. The === is comparing the return values.

Consider this example:

  function onePlusOne() { return 1 + 1; }
  function two() { return 2; }

  alert( onePlusOne === two );  // false, not the same function
  alert( onePlusOne() === two() );  // true, same value




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: