Hey there! Sign in to join this conversationNew here? Join for free
x Turn on thread page Beta

recursion in javascript watch

Announcements
    • Thread Starter
    Offline

    1
    ReputationRep:
    Hey Guys

    I posted code for a shopping cart about a week ago. I still havent sorted the problem out, if any of you can explain how I can solve recursion I would appreciate it.


    Kate
    • Thread Starter
    Offline

    1
    ReputationRep:
    Well its a shopping cart, so its to do with variables of price, item and total cost. I run the order once, it displays each of these undefined. I run the order again, it works fine.
    Offline

    0
    ReputationRep:
    Thats definitely a tail recursion solution (iteration), nothing to do with recursion, it is unnecessary and will be slower.
    • Thread Starter
    Offline

    1
    ReputationRep:
    Any ideas how to solve this?
    Offline

    0
    ReputationRep:
    post the code back up and we may be able to help you
    • Thread Starter
    Offline

    1
    ReputationRep:
    code attached

    Note: The code will only work if you take '1' off the end of the file names. It would'nt let me send the html pages.

    Thanks

    I have also included a screenshot of the error.
    Attached Images
     
    Attached Files
  1. File Type: txt OrderTattooDesigns1.txt (2.9 KB, 88 views)
  2. File Type: txt OrderDesigns1.txt (3.2 KB, 54 views)
  3. File Type: txt FinalOrder1.txt (3.9 KB, 67 views)
 
 
 
Poll
Do you agree with the proposed ban on plastic straws and cotton buds?
Useful resources

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reply
Hide
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.