Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width">
- <title>JS Bin</title>
- </head>
- <body>
- <script id="jsbin-javascript">
- var res = [
- {
- photos:'1,2,3,4,5'
- },
- {
- photos:'5,6,7,8,9'
- }
- ]
- res.forEach((item)=>{
- item.photos = item.photos.split(',')
- // item.photos.forEach((childItem)=>{
- // childItem = '1' + childItem;
- // })
- for(let i =0;i<item.photos.length;i++){
- item.photos[i] = '1'+item.photos[i]
- }
- })
- console.log(res);
- </script>
- <script id="jsbin-source-javascript" type="text/javascript">var res = [
- {
- photos:'1,2,3,4,5'
- },
- {
- photos:'5,6,7,8,9'
- }
- ]
- res.forEach((item)=>{
- item.photos = item.photos.split(',')
- // item.photos.forEach((childItem)=>{
- // childItem = '1' + childItem;
- // })
- for(let i =0;i<item.photos.length;i++){
- item.photos[i] = '1'+item.photos[i]
- }
- })
- console.log(res);</script></body>
- </html>
Add Comment
Please, Sign In to add comment