Created
April 30, 2018 16:21
-
-
Save timbec/5e4bf29379ce93d363456eb395cea1f9 to your computer and use it in GitHub Desktop.
JS Bin// source http://jsbin.com/dodukacozo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tags = [ | |
{ | |
id: 3, | |
name: "Stories", | |
created_at: "2018-04-06 14:24:25", | |
updated_at: "2018-04-06 14:24:25", | |
pivot: { | |
work_id: 14, | |
tag_id: 3 | |
} | |
}, | |
{ | |
id: 5, | |
name: "Examples", | |
created_at: "2018-04-06 14:41:35", | |
updated_at: "2018-04-06 14:41:35", | |
pivot: { | |
work_id: 14, | |
tag_id: 5 | |
} | |
} | |
] | |
var tagArray = []; | |
var i, item; | |
for (i = 0; i < tags.length; i++) { | |
for (item in tags[i]) { | |
if (item === 'name') { | |
console.log(tags[i][item]); | |
tagArray.push(tags[i][item]); | |
} | |
} | |
} | |
console.log(tagArray); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment