Looks like the issue there is the if else blocks for buying and selling, they should really have {} (currently missing) since they are more than one line and would make the javascript easier to read and interpret. It's why this error does not occur on the try your luck function. I also found...