Create List in javascript

Asked

Viewed 367 times

-1

I have a view and within that view, have my scripts, need to create a function that creates a lista of my ViewModel ex: public static List<ContatosViewModel> ListaContatos = new List<ContatosViewModel>(); however, in javascript I can’t do it, there is list in javascript? and how I can create a lista, using a ViewModel

I want to take data from a grid and add to a lista all this through a function in javascript, but I do not know how to create a list in javascript

  • What you want to do on your page?

  • I want to take data from a grid and add to a list, but this through a function me javascript, but I do not know how to create this list

  • Present your code, it’s not very clear what you’re trying to do

1 answer

1


If you use pure js, you can create an array of anonymous objects, example:

var test = [ { nome: 'João', idade: '23'}, { nome: 'Henrique', idade: '18'} ];

or an array of numbers

var test = [1,2,3,4];

Browser other questions tagged

You are not signed in. Login or sign up in order to post.