Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: Unexpected token ++ #514

Closed
g8up opened this issue Aug 28, 2014 · 3 comments
Closed

SyntaxError: Unexpected token ++ #514

g8up opened this issue Aug 28, 2014 · 3 comments
Milestone

Comments

@g8up
Copy link

g8up commented Aug 28, 2014

before:

var c = "_ACTION_TO_NATIVEAPI_" + g++ + +new Date;

after:

var c = "_ACTION_TO_NATIVEAPI_" + g++++new Date;

version info:
{
"description": "Javascript formatting for Sublime Text 2 & 3",
"url": "https://github.com/jdc0589/JsFormat",
"version": "2014.05.13.01.58.57"
}

@bitwiseman
Copy link
Member

What is +new?

@g8up
Copy link
Author

g8up commented Aug 29, 2014

+new Date() is short for Number( new Date() )
aftter grunt-contrib-uglify , it becomes +new Date

@bitwiseman
Copy link
Member

Ah, here's a stack overflow on this:
http://stackoverflow.com/questions/221539/what-does-the-plus-sign-do-in-return-new-date

So in the case of g++ + +new Date() the spaces around the third plus sign have meaning. ... Technically, that plus sign is redundant, but we should still handle it. Interesting bug.

@bitwiseman bitwiseman added this to the v1.5.2 milestone Aug 29, 2014
@bitwiseman bitwiseman added the bug label Aug 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants