Guest User

Untitled

a guest
Oct 19th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width">
  6. <title>JS Bin</title>
  7. </head>
  8. <body>
  9.  
  10. <script id="jsbin-javascript">
  11. var res = [
  12. {
  13. photos:'1,2,3,4,5'
  14. },
  15. {
  16. photos:'5,6,7,8,9'
  17. }
  18. ]
  19.  
  20. res.forEach((item)=>{
  21. item.photos = item.photos.split(',')
  22. // item.photos.forEach((childItem)=>{
  23. // childItem = '1' + childItem;
  24. // })
  25. for(let i =0;i<item.photos.length;i++){
  26. item.photos[i] = '1'+item.photos[i]
  27. }
  28. })
  29. console.log(res);
  30. </script>
  31.  
  32.  
  33.  
  34. <script id="jsbin-source-javascript" type="text/javascript">var res = [
  35. {
  36. photos:'1,2,3,4,5'
  37. },
  38. {
  39. photos:'5,6,7,8,9'
  40. }
  41. ]
  42.  
  43. res.forEach((item)=>{
  44. item.photos = item.photos.split(',')
  45. // item.photos.forEach((childItem)=>{
  46. // childItem = '1' + childItem;
  47. // })
  48. for(let i =0;i<item.photos.length;i++){
  49. item.photos[i] = '1'+item.photos[i]
  50. }
  51. })
  52. console.log(res);</script></body>
  53. </html>
Add Comment
Please, Sign In to add comment