javascript - Find the substrings in a string and put them in an array -


so have string (line-breaks added):

var str = '[{"id":1,"type":"one","status":"pending","user_id":2},             {"id":2,"type":"two","status":"pending","user_id":14},             {"id":3,"type":"three","status":"queue","user_id":5},             {"id":4,"type":"four","status":"queue","user_id":8 }]'; 

what algorithm can use type values in 1 array? result "one", "two", "three", "four".

if you're writing es6, following @arunpjohny:

array.map(elt => elt.type) 

or

[ (elt of array) elt.type ] 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -