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
The reason this is mentioned (and things like the part about caching array length in your for loop) is that this tutorial was mostly written back in 2006, when things were obviously a bit different with JavaScript. The article has gotten updates since then (check the history), but not many and not to the extent it probably needs. Not sure why it keeps getting linked.
A re-introduction to JavaScript
81–90 of 115 posts
Re: A re-introduction to JavaScript
#82Earlier quoted context omitted.
Is not a JS only thing, investigate how floating point values work.
Well other languages often offer decimal, or higher precision floats, right?
Approximate Range -> (-7.9 x 1028 to 7.9 x 1028) / (100 to 28)
Precision -> 28-29 significant digits
Re: A re-introduction to JavaScript
#83Earlier quoted context omitted.
Is not a JS only thing, investigate how floating point values work.
Well other languages often offer decimal, or higher precision floats, right?
Re: A re-introduction to JavaScript
#84Earlier quoted context omitted.
They have to. There's a bug in the JavaScript spec that makes you do this :-) they are perfectly correct in doing what they are doing, if they didn't then funny thing would start to happen. Sad, but true.
Uh, what's the reason for the downvote?
Re: A re-introduction to JavaScript
#85Earlier quoted context omitted.
Especially when you need to do something like: var that = this;
That's not generally necessary in ES6 when you use "=>" to define functions. Javascript is getting better...
Re: A re-introduction to JavaScript
#86> 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
Re: A re-introduction to JavaScript
#87Earlier quoted context omitted.
They have to. There's a bug in the JavaScript spec that makes you do this :-) they are perfectly correct in doing what they are doing, if they didn't then funny thing would start to happen. Sad, but true.
Uh, what's the reason for the downvote?
Re: A re-introduction to JavaScript
#88> 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
Number automatically accepts exponent notation and auto-converts to hex (ignoring octal). parseInt() auto-converts hex and octal unless a radix is specified, but it also ignores the remaining non-number characters at the end of the string.
There isn't a single method that does whatever you want.
Re: A re-introduction to JavaScript
#89"While often derided as a toy" Javascript is not a toy; toys are fun.
Re: A re-introduction to JavaScript
#90Keep up the good work Mozilla.
edit: I see MANY people contributed! You can too! https://developer.mozilla.org/en-US/docs/Mozilla/Connect. It still would be cool if Eich could act as an "editor" to JS related articles!