Макс Ланкастер,
<!doctype html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script>
document.addEventListener( "DOMContentLoaded" , function() {
let text = document.querySelector(".text");
let res = document.querySelector(".result");
let button = document.querySelector(".button");
const market = [
{ name: "Rick", bonus: 0 },
{ promo: 333, points: 10 },
{ promo: 222, points: 100 },
{ promo: 111, points: 1000 },
{ promo: 000, points: 10000 },
];
button.addEventListener("click", () => {
const data = market.find(({name})=> name);
const {points} = market.find(({promo})=> promo == text.value)||{points : 0};
if(points) data.bonus += points;
res.innerHTML += `<br>${data.name}, по коду ${text.value} ${points ? 'бонус: ' + points : 'ничего нет'}, всего: ${data.bonus}`;
text.value = ''
})
});
</script>
</head>
<body>
<input class="text" type="text" />
<input class="button" type="button" value="Получить бонус" />
<p class="result"></p>
</body>
</html>