How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask ATLPROG Your Own Question

ATLPROG
ATLPROG, Computer Software Engineer
Category: Programming
Satisfied Customers: 7677
Experience:  MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
44910485
Type Your Programming Question Here...
ATLPROG is online now
A new question is answered every 9 seconds

Please help with a JavaScript program. I have a few

Customer Question

Please help with a JavaScript program. I have a few questions about concepts. First, I'm trying to get the swap array function to work. https://www.sendspace.com/file/ni6ku3
Submitted: 1 year ago.
Category: Programming
Expert:  Satchi replied 1 year ago.
Hi Welcome to Justanswer, I will be more than happy to assist you today .
What is the problem you are facing with the code or May I know the full requirement ?
Customer: replied 1 year ago.
Hi, thank you so much. I can't get the swap array function to work. I know it works; I tested it on other programs.
Expert:  Satchi replied 1 year ago.

Ok let me check .

From where you got the code ?

Customer: replied 1 year ago.
I wrote it, except the swap array, but I tested that on an array that wasn't an object.
Expert:  Satchi replied 1 year ago.

There is no swaparray function ?

Customer: replied 1 year ago.
It's Array.prototype.swap(o, n) for the two values.
Expert:  Satchi replied 1 year ago.

OK

What is the error you are getting ?

Customer: replied 1 year ago.
I'm not getting an error; it just won't exchange the card values. When you click on draw and then a human card, it's supposed to swap them.
Expert:  Satchi replied 1 year ago.

Actually I am seeing two buttons for Draw Pile and Discard piles .

If I am clicking Drawpile(blank) then popup coming variable undefined

Discard file button is not working

Customer: replied 1 year ago.
don't worry about discard. I was testing the variable of the draw pile; you can comment that alert out. You'll see the line before where I try to swap the two values, but I don't think one value has the index.
Expert:  Satchi replied 1 year ago.

This Array.prototype.swap is not being called when I am clicking Draw button

Customer: replied 1 year ago.
Really? I also don't think the oldCard and newCard hold indexes, but I'm not sure. I know newCard does when I alert it when pressing human cards.
Customer: replied 1 year ago.
Did you uncomment out the deck.swap line?
Expert:  Satchi replied 1 year ago.

You can try the code

Customer: replied 1 year ago.
Thanks! Let me take a look.
Expert:  Satchi replied 1 year ago.

I have just removed the alert and cleared syntax errors

Customer: replied 1 year ago.
Ok. The racks no longer show. ...
Expert:  Satchi replied 1 year ago.

Ok

Its very difficult to get the requirment I will open the question to others to help you

Customer: replied 1 year ago.
Sorry about that. Thanks for trying.