I have the array of objects and i am trying to show the records based upon some filtration,
I am doing in VUE
Here is my code
return this.system.filter(function (item, key) {
if(key.)
});
what i am tryin to achieve , if the key is: 1,2,3,4,5 it should be equal to 9 and display A because 9 is equal to A
because my keys are like this
this.system = [
{
key:0,"value:"x"
},
{
key:1,"value:"x1"
},
{
key:2,"value:"x2"
},
{
key:3,"value:"x3"
},
{
key:4,"value:"x4"
},
{
key:5,"value:"x5"
},
{
key:6,"value:"x6"
},
{
key:7,"value:"x7"
},
{
key:8,"value:"x8"
},
{
key:9,"value:"A"
},
{
key:10,"value:"B"
},
{
key:11,"value:"C"
},
{
key:12,"value:"D"
},
]
2
Answers
If I understood you correctly :
As per my understanding, You want to return value of
value
property based on the value ofkey
property. If Yes, You can simply achieve that by usingArray.find()
method. Here you go :