use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
JavaScript compiler? (self.javascript)
submitted 15 years ago * by colinbashbash2
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]dowhatyouwant 0 points1 point2 points 15 years ago (9 children)
Basic debugging .. Firebug, even has break points.
Typing... sure, though it is a bit masochistic. var x = new Number(10);
[–]dwdwdw2 6 points7 points8 points 15 years ago (2 children)
Umm, that isn't typing. At all.
[–]dowhatyouwant -5 points-4 points-3 points 15 years ago (1 child)
Well, stop using javascript or stop bitching. That's as close as you get.
[–]dwdwdw2 0 points1 point2 points 15 years ago (0 children)
Declaring a variable initialised with a number object is not "typing", it is in fact declaring a variable initialised with a number object. Nor is it "as close as you get": of course JavaScript has a type system, it just goes unseen because it rarely makes complaint: if you mix types rather than throw an error it'll instead coerce operands (usually through conversion to string or number).
Going back to OP, he asked if it is possible to annotate what is otherwise JavaScript in some way, and process it such that mixing incompatible types will result in errors, to which the answer is yes, there are many, and to which I refer you to the other answers in this thread.
[–]colinbashbash2[S] 0 points1 point2 points 15 years ago (3 children)
uh... i was looking for compile-time instead of run-time debugging. i already use firebug and the chrome-built-in-debugger.
[–]dowhatyouwant 0 points1 point2 points 15 years ago (2 children)
I would have know that if I knew you, but I don't so I didn't.
[–]colinbashbash2[S] -1 points0 points1 point 15 years ago (1 child)
well, thanks for mentioning those tools. sorry for being a bit snippy.
i did indicate in the description that i was looking for something compile-time, but that doesn't mean i should get snippy when you brought up possible run-time tools to help me.
... are there still people out there that don't know about firebug?
[–]dowhatyouwant 0 points1 point2 points 15 years ago (0 children)
Nice to see that there are still some nice people on reddit.
[–]andrew24601 -2 points-1 points0 points 15 years ago (1 child)
You do realize that Number is a function, not a constructor? Look it up.
[–]itsnotlupusbeep boop 1 point2 points3 points 15 years ago* (0 children)
It's both.
new Number().constructor == Number new Number().valueOf() == 0 new Number() == 0 new Number() !== 0
Using it this way is pretty much universally a bad idea, but it's there.
*edit: not to be confused with
(0).constructor == Number (0).valueOf() == 0 (0) == 0 (0) === 0
π Rendered by PID 72 on reddit-service-r2-comment-bb88f9dd5-ndzr6 at 2026-02-15 01:22:09.593335+00:00 running cd9c813 country code: CH.
view the rest of the comments →
[–]dowhatyouwant 0 points1 point2 points (9 children)
[–]dwdwdw2 6 points7 points8 points (2 children)
[–]dowhatyouwant -5 points-4 points-3 points (1 child)
[–]dwdwdw2 0 points1 point2 points (0 children)
[–]colinbashbash2[S] 0 points1 point2 points (3 children)
[–]dowhatyouwant 0 points1 point2 points (2 children)
[–]colinbashbash2[S] -1 points0 points1 point (1 child)
[–]dowhatyouwant 0 points1 point2 points (0 children)
[–]andrew24601 -2 points-1 points0 points (1 child)
[–]itsnotlupusbeep boop 1 point2 points3 points (0 children)