I’m having this below array, where I need to update the key value as
From Apple fruit to Pizza shop, Orange fruit to Kfc shop, Banana fruit to Mcdonald shop, Mango fruit to fries shop if any one the value pair exceeds 28 characters, if it doesn’t exceed 28 characters, it should remain the same response.
For instance in this Testing 3 has value that exceeds 28 characters
[
{
"key": "Apple fruit",
"value": "66789/74657/37485/67543"
},
{
"key": "Orange fruit",
"value": "66789/74657/37485/67543"
},
{
"key": "Banana fruit",
"value": "3647586/456765/345654/36789876/76"
},
{
"key": "Mango fruit",
"value": "66789/74657/37485/67543"
}
]
My code
this.testItem.push({
key: testlabel,
value: testvale,
});
console.log(this.testItem);
this.testItem has the array of value I have mentioned above, any help ?
4
Answers
You could do something like this:
Your initial specs are a bit unclear, but regardless. Here is the code that will achieve what you are requesting:
Here we are:
in place of hello write code to change value