Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. var myObj = {
  2. "number": 10,
  3. "general": "general",
  4. "array": [{
  5. "num1": 11,
  6. "text": "text1",
  7. }, {
  8. "num2": 1,
  9. "text": "text2",
  10. }, {
  11. "num3": 3,
  12. "text": "text3",
  13.  
  14. } ]
  15. };
  16.  
  17. for (i=0; i <myObj.array.length; i++) {
  18. a = myObj.array[i].text
  19. a1 += a
  20. }
  21.  
  22. var myObj = {
  23. "number": 10,
  24. "general": "general",
  25. "array": [{
  26. "num1": 11,
  27. "text": "text1",
  28. }, {
  29. "num2": 1,
  30. "text": "text2",
  31. }, {
  32. "num3": 3,
  33. "text": "text3",
  34.  
  35. }, ]
  36. };
  37.  
  38. var a1 = [];
  39. for (i=0; i <myObj.array.length; i++) {
  40. a1.push(myObj.array[i].text);
  41. }
  42. a1.join(',')
  43.  
  44. myObj.array.map(function (item) {
  45. return item.text;
  46. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement