Skip to content

reverse loop #1187

Closed
Closed
@zanona

Description

Hi, is there any way to achieve a reverse loop with the standard loop api?

medias = body.getElementsByTagName('div')

for media in medias
  mediaElement.appendChild(media)

`for(var i=medias.length; i>0; i--){
  mediaElement.appendChild(medias[i-1]);
}`

on a case like above I found no way to implement it so I have to write javascript instead.

in this case as we're dealing with a array of document elements the array.reverse() is not available

so my question would be how to achieve that in coffeescript?
Thanks

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions