Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Constructed/Instantiated primitives should be stringified like their primitive equivalants. #60

Closed
Krinkle opened this issue May 23, 2014 · 2 comments

Comments

@Krinkle
Copy link
Owner

Krinkle commented May 23, 2014

From timotijhof on June 13, 2012 18:15:33

Stringify something like new Number(7); or new Number('hello');

It should output '7' and '"hello"'. Instead it becomes:

new Number(7); became:
{}

new String('hello'); became:
{"0":"h","1":"e","2":"l","3":"l","4":"o"}

Now, I don't have a strong opinion on that. Actually, I think treating them as objects is perfectly fine because they are objects (note that one should probably never really construct a primitive in serious code, but whatever). The main reason I'm filing this as a bug is because the implementation of the browser vendors is different, and we should aim to mach that.

Original issue: http://code.google.com/p/jquery-json/issues/detail?id=60

@Krinkle
Copy link
Owner Author

Krinkle commented May 23, 2014

From krinklemail on June 13, 2012 09:30:28

Fixed in https://code.google.com/p/jquery-json/source/detail?r=45 .

Status: Fixed

@Krinkle
Copy link
Owner Author

Krinkle commented May 23, 2014

From krinklemail on June 13, 2012 10:06:22

Summary: Constructed/Instantiated primitives should be stringified like their primitive equivalants.

@Krinkle Krinkle closed this as completed May 23, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant