HTTP/2 200
last-modified: Sat, 27 Dec 2025 01:06:30 GMT
x-goog-storage-class: STANDARD
referrer-policy: strict-origin-when-cross-origin
via: 1.1 google, 1.1 varnish, 1.1 varnish, 1.1 varnish, 1.1 varnish
x-goog-metageneration: 1
x-goog-meta-goog-reserved-file-mtime: 1766796597
server: Google Frontend
x-goog-stored-content-length: 156256
x-goog-stored-content-encoding: identity
cache-control: public, max-age=3600
content-type: text/html
x-guploader-uploadid: AHVrFxOIo9Jql8OObxMYD5vaKKTjJhtpZtIGNm4cIvL3UluBRV8WRScfusf-21JjMm_78nG9tgkdr1A
origin-trial: AxVILwizhbMjxFeHOn1P3R8niO1RJY/smaK4B4d1rLzc1gTaxtXMSaTi+FoigYgCw40uFRDwFcEAeqDR+vVLOW4AAABfeyJvcmlnaW4iOiJodHRwczovL2RldmVsb3Blci5tb3ppbGxhLm9yZyIsImZlYXR1cmUiOiJQcml2YXRlQXR0cmlidXRpb25WMiIsImV4cGlyeSI6MTc0MjA3OTYwMH0=
x-goog-generation: 1766797590630190
x-cloud-trace-context: 3f2c17a2d777a050a957cfa60ee58f0e
expires: Sat, 27 Dec 2025 02:50:09 GMT
etag: "25fe3382d44ecd398b25f5b58d24c73a"
x-goog-hash: crc32c=c3ClNg==, md5=Jf4zgtROzTmLJfW1jSTHOg==
x-frame-options: DENY
strict-transport-security: max-age=63072000
x-content-type-options: nosniff
content-security-policy: default-src 'self'; script-src 'report-sample' 'self' 'wasm-unsafe-eval' https://www.google-analytics.com/analytics.js https://*.googletagmanager.com assets.codepen.io production-assets.codepen.io https://js.stripe.com 'sha256-XNBp89FG76amD8BqrJzyflxOF9PaWPqPqvJfKZPCv7M=' 'sha256-YCNoU9DNiinACbd8n6UPyB/8vj0kXvhkOni9/06SuYw=' 'sha256-PZjP7OR6mBEtnvXIZfCZ5PuOlxoDF1LDZL8aj8c42rw='; script-src-elem 'report-sample' 'self' 'wasm-unsafe-eval' https://www.google-analytics.com/analytics.js https://*.googletagmanager.com assets.codepen.io production-assets.codepen.io https://js.stripe.com 'sha256-XNBp89FG76amD8BqrJzyflxOF9PaWPqPqvJfKZPCv7M=' 'sha256-YCNoU9DNiinACbd8n6UPyB/8vj0kXvhkOni9/06SuYw=' 'sha256-PZjP7OR6mBEtnvXIZfCZ5PuOlxoDF1LDZL8aj8c42rw='; style-src 'report-sample' 'self' 'unsafe-inline'; object-src 'none'; base-uri 'self'; connect-src 'self' developer.allizom.org bcd.developer.allizom.org bcd.developer.mozilla.org updates.developer.allizom.org updates.developer.mozilla.org https://*.google-analytics.com https://*.analytics.google.com https://*.googletagmanager.com https://incoming.telemetry.mozilla.org https://observatory-api.mdn.allizom.net https://observatory-api.mdn.mozilla.net https://api.github.com/search/issues stats.g.doubleclick.net https://api.stripe.com; font-src 'self'; frame-src 'self' mdn.github.io *.mdnplay.dev *.mdnyalp.dev *.play.test.mdn.allizom.net https://v2.scrimba.com https://scrimba.com jsfiddle.net www.youtube-nocookie.com codepen.io survey.alchemer.com https://js.stripe.com; img-src 'self' data: *.githubusercontent.com *.googleusercontent.com *.gravatar.com mozillausercontent.com firefoxusercontent.com profile.stage.mozaws.net profile.accounts.firefox.com developer.mozilla.org mdn.dev wikipedia.org upload.wikimedia.org https://mdn.github.io/shared-assets/ https://mdn.dev/ https://*.google-analytics.com https://*.googletagmanager.com www.gstatic.com; manifest-src 'self'; media-src 'self' archive.org videos.cdn.mozilla.net https://mdn.github.io/shared-assets/; child-src 'self'; worker-src 'self';
content-encoding: gzip
accept-ranges: bytes
age: 3251
date: Sat, 27 Dec 2025 22:07:11 GMT
x-served-by: cache-bfi-krnt7300071-BFI, cache-bfi-krnt7300082-BFI, cache-sin-wsss1830034-SIN, cache-bom-vanm7210030-BOM
x-cache: MISS, MISS, HIT, MISS
x-cache-hits: 0, 0, 97, 0
x-timer: S1766873232.701578,VS0,VE61
vary: Accept-Encoding
content-length: 20512
Object.is() - JavaScript | MDN
console.log(Object.is("1", 1));
// Expected output: false
console.log(Object.is(NaN, NaN));
// Expected output: true
console.log(Object.is(-0, 0));
// Expected output: false
const obj = {};
console.log(Object.is(obj, {}));
// Expected output: false
Object.is(value1, value2)
value1
The first value to compare.
value2
The second value to compare.
A boolean indicating whether or not the two arguments are the same value.
Object.is() determines whether two values are the same value . Two values are the same if one of the following holds:
both undefined
both null
both true or both false
both strings of the same length with the same characters in the same order
both the same object (meaning both values reference the same object in memory)
both BigInts with the same numeric value
both symbols that reference the same symbol value
both numbers and
both +0
both -0
both NaN
or both non-zero, not NaN , and have the same value
Object.is() is not equivalent to the == operator. The == operator applies various coercions to both sides (if they are not the same type) before testing for equality (resulting in such behavior as "" == false being true), but Object.is() doesn't coerce either value.
Object.is() is also not equivalent to the === operator. The only difference between Object.is() and === is in their treatment of signed zeros and NaN values. The === operator (and the == operator) treats the number values -0 and +0 as equal, but treats NaN as not equal to each other.
// Case 1: Evaluation result is the same as using ===
Object.is(25, 25); // true
Object.is("foo", "foo"); // true
Object.is("foo", "bar"); // false
Object.is(null, null); // true
Object.is(undefined, undefined); // true
Object.is(window, window); // true
Object.is([], []); // false
const foo = { a: 1 };
const bar = { a: 1 };
const sameFoo = foo;
Object.is(foo, foo); // true
Object.is(foo, bar); // false
Object.is(foo, sameFoo); // true
// Case 2: Signed zero
Object.is(0, -0); // false
Object.is(+0, -0); // false
Object.is(-0, -0); // true
// Case 3: NaN
Object.is(NaN, 0 / 0); // true
Object.is(NaN, Number.NaN); // true
Enable JavaScript to view this browser compatibility table.