Skip to content

Instantly share code, notes, and snippets.

@megatroom
Last active Feb 13, 2020
Embed
What would you like to do?
JavaScript Functions equality comparisons and sameness
const functionA = () => {};
const functionB = () => {};
const copyFromB = functionB;
functionA === functionA // true
functionB === functionB // true
functionB === copyFromB // true
functionB == copyFromB // true
Object.is(functionB, copyFromB) // true
functionA === functionB // false
functionA == functionB // false
Object.is(functionA, functionB) // false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment