I have an array below that needs to be updated with key values changed from Apple fruit to Pizza shop, Orange fruit to Kfc shop, Banana fruit to Mcdonald shop, Mango fruit to fries shop if any of the value pairs exceed 15 characters. If the character count does not exceed 15, the response should remain the same.
For example, "Testing 3" has a value that exceeds 15 characters.
[
{
"key": "Apple fruit",
"value": "12123124344234234"
},
{
"key": "Orange fruit",
"value": "234352342332525"
},
{
"key": "Banana fruit",
"value": "235235235235235235235"
},
{
"key": "Mango fruit",
"value": "235325235235235"
}
]
My code snippet:
this.testItem.push({
key: testlabel,
value: testvale,
});
console.log(this.testItem);
this.testItem contains the mentioned array values above. Can anyone help me out?