Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var teste1 = {id: "Nattan", category: "Categoria1"}
- var teste3 = {id: "Nattan2", category: "Categoria2"}
- var teste2 = {id: "Nattan3", category: "Categoria3"}
- var arr = { apps: [] }
- for(var i = 0; i < 3; i++){
- var r = resultado(i);
- arr.apps.push(r);
- }
- console.log(arr);
- function resultado(id){
- if(id == 0){
- return teste1;
- }
- if(id == 1){
- return teste2;
- }
- if(id == 2){
- return teste3;
- }
- }
- /*
- { apps:
- [ { id: 'Nattan', category: 'Categoria1' },
- { id: 'Nattan3', category: 'Categoria3' },
- { id: 'Nattan2', category: 'Categoria2' } ] }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement