IIRC, I read somewhere that one should prefer to use
primitives such as "abc"; one should not create objects
via »new String ( "abc )« (or, »new Number( 7 )«).
I am not sure why »new String( "abc" )« should be bad style.
For example, I consider the following piece of code:
{ "abc".charAt( 0 );
"abc".charAt( 1 );
"abc".charAt( 2 ); }
(Of course, the example with »"abc".charAt( 0 );« is nonsense.)
. Above, AFAIK, the primitve "abc" was implicitly converted
into an object /three times/. If one would have written:
{ let abc = new String( "abc" );
abc.charAt( 0 );
abc.charAt( 1 );
abc.charAt( 2 ); }
only one object would have been created. Wouldn't this be more
efficient? So, why could it be bad style?