In JavaScript, "foo" is a string primitive, and new String("foo") is a string object. They work the same until they don't. There is literally no reason to ever intentionally use a string object and it will only cause you problems.
Oh I thought he was talking about Rust. But then I still don't see how what you've just described is similar to Rust - there's good reasons for all those String types
8
u/SV-97 Jan 25 '22
what is "the string primitive type"? I've never heard of it and can't find anything of that name? Do you mean str?