.downto loop in JS (script call)?

In RMVX ACE i had a .downto loop which I used to check if two events are on the same spot/tile.


This is how the script call looked:

Spoiler
Spoiler






$player_count.downto(1) do |i|
if $game_map.events[$turn_number].x == $game_map.events.x then
if $game_map.events[$turn_number].y == $game_map.events.y then
if $turn_number != i
$enemy = i
end
end
end
end







Because RMMV completely destroyed all the script calls... I mean..  it was made easier.., aswell as the code syntax I have no Idea how I can translate this into a JS script call.


Can someone help me out please? 😮
How about this?

Code:
for (var i = x; i >= 1; i--) {
    // Loop contents go here
}
Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/downto-loop-in-js-script-call.55627/