Advertisement
Guest User

Swiggy code

a guest
May 23rd, 2022
5,069
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1.  
  2. amount_node_list = document.getElementsByClassName('_3Hghg');
  3. amount_regex = /\d+.\d*/g;
  4. total_amount = 0
  5. for (let i = 0; i < amount_node_list.length; i++) {
  6. current_amount = amount_node_list[i].innerHTML;
  7. if (current_amount.match(amount_regex)) {
  8. integer_amount = parseInt(current_amount.match(amount_regex)[0])
  9. total_amount += integer_amount;
  10. }
  11. }
  12. console.log("Total amount spent on Swiggy so far is INR ", total_amount);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement