Live data from Hacker News

A re-introduction to JavaScript

developer.mozilla.org

61–70 of 115 posts

Re: A re-introduction to JavaScript

#61

Earlier quoted context omitted.

https://news.ycombinator.com/newsguidelines.html

"Please don't insinuate that someone hasn't read" the Hacker News Guidelines...

I'm not insinuating, I'm telling you.

Incidentally, can you not see the irony of your own statement? Please, stop with your valueless comments. This article is and remains a perfectly valid submission to HN.

Re: A re-introduction to JavaScript

#63
One caveat not mentioned is that while float is 64 bit floating point number, int is only 53 bit integer, unlike having 64 bit int in most other languages. Yeah, I've got bitten by this before causing a nasty bug.

Re: A re-introduction to JavaScript

#64
post #45

Earlier quoted context omitted.

Can you expand on what you said about the `delete` keyword implications with the GC? I've never heard of that issue.

I haven't either, only that delete will cause code to be de-optimized.

I think it affected earlier versions of IE - Douglas Crockford detailed an issue here:

http://javascript.crockford.com/memory/leak.html

Re: A re-introduction to JavaScript

#65
post #12

> You can also use the unary + operator to convert values to numbers: + "42"; // 42 > [...] However the "+" operator simply converts the string to NaN if there is any invalid character in it. Being a bit pedantic here, why not recommending the Number function which may be less obscure for beginners? Number("42"); // 42

Correct me if I'm wrong, but I thought that the unary operator and the Number constructor yield equivalent results?

Re: A re-introduction to JavaScript

#66

I think there's no point trying to avoid memory leaks in older versions of IE. Circular references due to closures are too common and it's not worth messing with your code. IE users are probably used to getting a horrible user experience anyway. I'm sure they can cope with a few browser freezes/crashes every once in a while - They know how to take a beating :p

It was very important for IE <=6. Early AJAX web apps like GMail ~2004 were quite hard to get right - avoid most memory JS leaks or the memory consumption got out of hand too fast. That was in the days of 512 MB memory and WinXP.

Re: A re-introduction to JavaScript

#67

I think there's no point trying to avoid memory leaks in older versions of IE. Circular references due to closures are too common and it's not worth messing with your code. IE users are probably used to getting a horrible user experience anyway. I'm sure they can cope with a few browser freezes/crashes every once in a while - They know how to take a beating :p

I was stunned when I read the part about hooking the "this page is done now, let's go to another" event to manually clean up memory. (Old) IE worse than failure, indeed.

Re: A re-introduction to JavaScript

#69
post #27

The article says to watch out for 0.1 + 0.2 not exactly equalling 0.3 , so as a complete newbie to JavaScript, how do you work around this ?

See if there is a fixed precision arithmetic library for JS? (similar to BigDecimal in Java / Groovy)

Homework: 1) Google for such; 2) see which one doesn't suck.

Re: A re-introduction to JavaScript

#70

Earlier quoted context omitted.

https://news.ycombinator.com/newsguidelines.html

"Please don't insinuate that someone hasn't read" the Hacker News Guidelines...

According to the guidelines, I should charitably interpret that you have read them. Which means, charitably, you are ignoring them.
Post reply on HN