And to answer, the `'k'` in `Object.prototype.toString.call( 'k' )` get auto-boxed. That's why.
On Fri, Jan 1, 2016 at 9:29 AM, Domenic Denicola <[email protected]> wrote: > This mailing list is largely meant for the further development of > JavaScript as a language (new feature design, spec review, etc.), and not > for questions on how JavaScript works. StackOverflow is indeed a better > venue for such questions. > > > > *From:* es-discuss [mailto:[email protected]] *On Behalf Of *Arup > Rakshit > *Sent:* Friday, January 1, 2016 12:28 > *To:* Bob Myers <[email protected]>; [email protected] > *Subject:* Re: Confusion with Object.prototype.toString and primitive > string datatype > > > > Hi Bob, > > > > Don’t we have any mailing list to ask JavaScript questions? I like mailing > list rather than StackOverflow.com <http://stackoverflow.com> :( > > > > > > > > On Jan 1, 2016, at 10:56 PM, Bob Myers <[email protected]> wrote: > > > > Seems like a good Stack Overflow question, take it there. > > > > On Fri, Jan 1, 2016 at 10:54 PM, Arup Rakshit <[email protected]> wrote: > > Hi, > > Consider the below simple code : > > 'k' instanceof String; // false > new String('k') instanceof String; // true > > Now, When I am inspecting them as below why in both cases the output comes > as [object String] ? > > The below is understood as per the result of the `instanceof` operator. > > Object.prototype.toString.call( new String('k') ); // "[object String]” > > My confusion comes when I see the below code output : > > Object.prototype.toString.call( 'k' ); // "[object String]” > > Can anyone please explain it ? > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss > > > > > > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss > >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

