Is there a way in JavaScript to check if 2 primitives point to the same memory location, I'm looking for some Python is operator-like solution
Python Code:
1 is 1 # true # means left and right operands point to the same memory address
JavasScript can do this to, but for objects only, is there a way to do this comparison for primitives?
U could use the strict equality operator (===)
console.log(1 === 1);
// expected output: true
console.log('hello' === 'hello');
// expected output: true
console.log('1' === 1);
// expected output: false
console.log(0 === false);
// expected output: false
See more in here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Strict_equality