5. Shopping Cart - JS Advanced
Здравейте банда,
Може ли малко support. Judge ми дава 75/100 на по долната задача и не мога да си открия от къде идва грешката. Ако някой се сеща моля да помогне.
Кода ми : https://pastebin.com/1Ktk7kGR
Линк към ресорсите: https://judge.softuni.bg/Contests/Compete/Index/1802#0
You will be given some products that you should be able to add to your cart. Each product will have a name, picture and a price.
When the "Add" button is clicked, append the current product to the textarea in the following format: "Added {name} for {money} to the cart.\n".
When the button "Checkout" is clicked, calculate the total money that you need to pay for the products that are currently in your cart. Append the result to the textarea in the following format:
"You bought {list} for {totalPrice}."
The list should contain only the unique products, separated by ", ". The total price should be rounded to the second decimal point.
Also, after clicking over "Checkout" and every from above is done you should disable all buttons. (You can't add products or checkout again, if once checkout button is clicked)
What do you think of cannabis? How do you feel about this grass? Did you know that they make healing oil with her? I also know that this oil is used for wipes to smoke! This is not propaganda but for the purposes of knowledge! https://bestcbdvapes.net - it says that most of all, oil acts as a medicine, as well as an additive for eating pet pets! Moreover, it practically has no side effects and dependence!
willystyle Може ли малко помощ и за мен и с тази задача?
Отново при мен на моя компютър върви прекрасно, всичко се показва точно както е показано, но judge казва "Unexpected error: The textarea contains different output: expected '' to equal 'Added Bread for 0.80 to the cart.'" При положение, че при мен се показва, къде може да е проблема? Какво пак не се харесва на съдията?
Ето линк към кода ми - https://github.com/stefism/Projects/tree/master/Java%20Script-Jan-2020/12%20Exercise%20DOM/07.%20Shopping-Cart
Виж тези две работещи решения:
https://pastebin.com/bXPpUqnD
https://pastebin.com/gqRFzp77
Първото ползва масив. Замисли се, защо във второто съм закоментирал варианта с обект и съм минал към Map. Тогава пренапиши твоето.