Answer the question
In order to leave comments, you need to log in
Is it possible to concatenate an array with an object? What to do for this?
Guys, hello everyone.
Tell me if it is possible somehow in an array of this kind
datas': [{label: 'Я ищу', value: 'Девушку'}, {label: 'Цели знакомства', value: ['поиск друзей', 'флирт', 'любовь']}, {label: 'Семейное пложение', value: 'холост'}, {label: 'Сексуальная ориентация', value: 'Гетеро'}, {label: 'Рост', value: '178 см'}, {label: 'Цвет волос', value: 'Блонд'}, {label: 'Телосложение', value: 'Стройное'}, {label: 'Цвет глаз', value: 'Зеленый'}, {label: 'Доход', value: 'Средний'}, {label: 'Национальность', value: 'русская'}, {label: 'Языки', value: ['русская', 'английский']}]
age:32
avatar:"thumb_20170718133451.jpg"
datas:Object
body:"Полное"
city:"Балларат"
country:"Австралия"
eye:"Зеленые"
hair:"Черные"
height:170
income:"Высокий"
langs:Array(1)
last_visit:Jan 1, 1970 1:00:00 AM"
nation:"Русский"
position:"Не замужем"
purposes: Array(1)
Answer the question
In order to leave comments, you need to log in
Only handles, there is not enough data to link the object and the array.
Or add type id to the array like this: {id: "hair", label: 'Hair color', value: 'Blonde'} and further:
datas.forEach(item => { item.value = obj[item.id] })
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question