Created
May 14, 2020 22:57
-
-
Save Yigaue/7989a2a776f232f85da06af63a311057 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data.map(item => { | |
if (item.price > 100) { | |
return { | |
id: item.id, | |
title: item.title, | |
price: item.price * (1 - 0.2) | |
}; | |
} | |
return item; | |
}); | |
console.log(data); | |
// result | |
/* | |
0: {id: 1, title: "Don't Waste your life ", price: 33, Author: "John Piper"} | |
1: {id: 2, title: "Living for a greater purpose", price: 12, Author: "JH Baritam"} | |
2: {id: 3, title: "The call for Mercy", price: 324} | |
3: {id: 4, title: "Heart Blindness", price: 440} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment