String Original value packaging type?

Viewed 32

let s1 = "some text";
let s2 = s1.substring(2);
console.log(s1);

let S1 = new String("some text");
let S2 = s1.substring(2);
S1 = null;
console.log(S1);

The book says that the logic of their code is the same, but the output is not null, the logic is different ? Are there errors in the book ?

0 Answers
Related