badlogic

storing data in an object looping javascript

Mar 16th, 2017
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $("#e1").select2( 'data',
  2.         sampleArray
  3.     );
  4. var preload_data = [
  5.         { id: 'user0', text: 'Disabled User', locked: true}
  6.         , { id: 'user1', text: 'Jane Doe'}
  7.         , { id: 'user2', text: 'John Doe', locked: true }
  8.         , { id: 'user3', text: 'Robert Paulson', locked: true }
  9.         , { id: 'user5', text: 'Spongebob Squarepants'}
  10.         , { id: 'user6', text: 'Planet Bob' }
  11.         , { id: 'user7', text: 'Inigo Montoya' }
  12.     ];
  13.  
  14.  
  15.  
  16.  
  17. for (var a in matchs)
  18.             {
  19.                 var variablesLable = matchs[a];
  20.                 var variableyValue = matchy[a];
  21.  
  22.                 // sampleArray = [{text:variablesLable,value:variableyValue}];
  23.                 sampleArray.push( { text: variablesLable, value:variableyValue} );
  24.  
  25.             }
Add Comment
Please, Sign In to add comment