In javascript all primitives (string, nubmer, bigint, boolean, undefined, symbol, null) are immutable and will be compared by value:
All primitives are immutable, i.e., they cannot be altered. It is important not to confuse a primitive itself with a variable assigned a primitive value. The variable may be reassigned a new value, but the existing value can not be changed in the ways that objects, arrays, and functions can be altered.
In comparison to that objects (this also includes arrays and functions, basically everything that is not a primitive) are mutable and will be compared by identity.
Example:
console.log("Primitives compare by value:");
console.log(5 === 5); // true
console.log("foo" === "foo"); // true
console.log(true === true); // true
console.log("Objects compare by identity:");
console.log({} === {}); // false
console.log([] === []); // false
console.log(function(){} === function(){}); // false
Primitive Wrappers
Javascript also has wrapper objects for the primitive types, which might be the source of your question.
These wrappers wrap a primitive value, and are - as the name suggests - objects. So for primitive wrapper instances your code would be correct:
let a = new Number(1);
let b = new Number(1);
console.log("Primitive wrappers are objects:");
console.log(a === a); // true
console.log(a === b); // false