mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +08:00
* Expand static three.js workflows and host integration * Preserve JavaScript class state in static three.js workflows * Preserve inferred JavaScript behavior across static workflows * Preserve inferred callables and native compatibility boundaries * Retain annotated JavaScript factory exports and bootstrap-safe call spreads * Preserve Buffer and child callback identities in static packages * Clarify JavaScript symbol spread support
16 lines
789 B
JavaScript
16 lines
789 B
JavaScript
function same(left, right) { return left == right; }
|
|
function different(left, right) { return left != right; }
|
|
for (const pair of [[2, 2], [2, "2"], [false, ""], [null, undefined], [NaN, NaN], [0, false], [1, true], ["x", 1], [undefined, 0]]) {
|
|
console.log(same(pair[0], pair[1]), different(pair[0], pair[1]));
|
|
}
|
|
const object = { valueOf() { return 3; } };
|
|
console.log(same(object, "3"), same(object, object), same(object, {}));
|
|
console.log(same(2n, "2"), same(2n, 2), same(2n, 2.5));
|
|
console.log(same(Symbol("a"), "a"));
|
|
class Radius {
|
|
constructor(value) { this.value = value; }
|
|
changed(value) { const previous = this.value; this.value = value; return previous != this.value; }
|
|
}
|
|
const radius = new Radius(3);
|
|
console.log(radius.changed(3), radius.changed(4), radius.changed("4"));
|