function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mohan sharmaMohan sharma 

How to create dynamically array in javascript.

I want to make dynamic array in javascript from controller and then use it visualforce page  i also want to push and pop some value from array.
Best Answer chosen by Mohan sharma
Deepak Kumar ShyoranDeepak Kumar Shyoran
You can create a javascript array using Apex:repeat
Let say if you want to create an arry of Id and you have those id’s in a list i.e lstOfAccIds you can use below code to create an JavaScript array.
<script>
Var listOfIds = new Array();
<apex:repeat value=”{! lstOfAccIds}  var=”key” >
listOfIds.push(key) ;
</apex:repeat>

Please mark it as best solution to your problem if it does solve your problem.

All Answers

Deepak Kumar ShyoranDeepak Kumar Shyoran
You can create a javascript array using Apex:repeat
Let say if you want to create an arry of Id and you have those id’s in a list i.e lstOfAccIds you can use below code to create an JavaScript array.
<script>
Var listOfIds = new Array();
<apex:repeat value=”{! lstOfAccIds}  var=”key” >
listOfIds.push(key) ;
</apex:repeat>

Please mark it as best solution to your problem if it does solve your problem.
This was selected as the best answer
Abilash Kosigi 8Abilash Kosigi 8
Mohan,

Can you please give more details as to what exactly you want to do.
Mohan sharmaMohan sharma
Thanks, My problem has been solved.