Using Join in Pas2JS

Top 

Example code : Using Join in Pas2JS

var

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

begin

 var fruits2 = fruits.Join('","');  

     WriteLn('["'+ fruits2 +'"]');

["Banana","Orange","Apple","Mango","Banana","Abacate","Abacaxi"]

 

 

JS output:

  var fruits = [];

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

  var fruits2 = "";

      fruits2 = (fruits).join("\",\"");

      WriteLn(("[\""+fruits2+"\"]"));