Using Reverse in Pas2JS

Top 

Example code : Using Reverse in Pas2JS

var

  fruits : array of String = ["Banana", "Orange", "Apple", "Mango", "Banana", "Abacate", "Apple"];

begin

  fruits.Reverse();

  for var Index := Low(fruits) to High(fruits) do

     WriteLn( fruits[Index] );

Apple

Abacate

Banana

Mango

Apple

Orange

Banana

---------------

 

JS output:

      var fruits = [];

      var fruits = ["Banana","Orange","Apple","Mango","Banana","Abacate","Apple"].slice();

      var Index = 0;

      fruits.reverse();

      var $temp24;

      for(Index = 0,$temp24 = fruits.length;Index<$temp24;Index++) {

         WriteLn($DIdxR(fruits,Index,""));