Closed Bug 987889 Opened 6 years ago Closed 6 years ago

Initialiser expression in the for(in) statement on bf4 site

Categories

(Web Compatibility :: Desktop, defect)

x86
macOS
defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: miketaylr, Unassigned)

References

()

Details

From es-discuss:

On 3/14/14, 15:53, Brendan Eich wrote:> Andreas Rossberg wrote:
>> On 14 March 2014 00:59, Oliver Hunt<oliver@apple.com>  wrote:
>>> >  JSC has been trying to kill off the initialiser expression in the for(in)
>>> >  statement, but we've encountered a bunch of reasonably significant content
>>> >  that breaks with it disallowed (a particularly prominent one currently is
>>> >  http://battlelog.battlefield.com/bf4/), so we will be bringing back support
>>> >  for
>>> >
>>> >  for (var Identifier = Expression in Expression)
>>
>> I'd be curious to know what the actual code is, and to get an idea why
>> they are using it that way.
> 
> http://battlelog.battlefield.com/bf4/
>     for (var i = 0 in debug.audio)
> 
> I say we should evangelize this site. Cc'ing some awesome Mozilla site
> evangelists.
Adam, do you think you could help us find a contact here?
So the suggested fix is simple here, just use a regular for loop:

for (var i = 0; i < audioLength; i++) {
    var elem = debug.audio[audioLength-i-1];
    ...
}
So it turns out an irc buddy (Markus) can likely help us out on this. CCing him. (small world and all that)
Ugh, that's some ugly code! Fix committed :)
Thanks so much!
Code is no longer on the site. Thanks again Marcus.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Blocks: 748550
Product: Tech Evangelism → Web Compatibility
You need to log in before you can comment on or make changes to this bug.