1

I have a problem with reading 1 value from browser console.

it looks like that

screenshot

I want to get the "xp" value and I did it, but only in that one case.

const quests = result.data.quests;
console.log(quests[1]);
var exp = quests[1].rewards;
var xp = exp.replaceAll('{"coins":3,"xp":', "");
var xp = xp.replaceAll(',"honor":0,"premium":0,"statPoints":0,"item":0}', "");
var xp = parseInt(xp);
console.log(xp);

In other cases the values of course will be different and it won't work, so how can I make the program get te same result every time?

Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
epekFloyd
  • 41
  • 8

0 Answers0