I have a my object as follows
$object_zero = {
'one' : 'one year',
'two' : 'two year',
'three' : 'there year',
'four' : 'four year',
'five' : 'five year',
'six' : 'six year',
'seven' : 'seven year',
'eight' : 'eight year',
};
I have a my other object as follows
$object = { 'one' : '1 Year', 'two' : '2 Year', 'three' : '3 Year', 'akta' : '12', 'mars' : '48' }
I can do it in php as follows.
foreach($object_zero as $key => $val){
echo $object->$key;
}
so how do i do this with vue.js?
I could not start it. my goal is to just write text containing the keys of the first object
<div v-for="(v, k, index) in data.object_zero">
<p v-if="object.k" class="mb-0">
{{ object.k }} -
</p>
</div>
For example, only these should be written on the screen.
print: 1 Year - 2 Year - 3 Year
x = [1, 2, "nice", true, "okay"]. So, basically your$arrayand$objectare the same in JS, both are objects. Also, what exactly are you trying to achieve as an end result: some i18n withone/1 year/one year?Object.keys(your_object)?