Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81803

Table not displaying correct answer. What am I doing wrong?

$
0
0

The code for my table is here http://live.datatables.net/jofuhaca/13/edit It runs on my pc but not on the live link, not sure why.
What I am trying to do, is collect api data on a loop and look for a difference in the 'price' object.
The code all runs on my pc except it appears to be calculating and displaying one row out. Console.log shows..

i 0 maintst.js:45:16
L 0.00000249  M 0.00000249  D -0.00000249 maintst.js:46:16
i 1 maintst.js:45:16
L 0.00001957  M 0.00001957  D -0.00001708 maintst.js:46:16
i 2 maintst.js:45:16
L 0.00000062  M 0.00000062  D 0.00001895 maintst.js:46:16
i 3 maintst.js:45:16
L 0.00000584  M 0.00000584  D -0.00000522 maintst.js:46:16
i 4 maintst.js:45:16
L 0.00000001  M 0.00000001  D 0.00000583

i is the counter, L is the lastPrice value M is the current price and D is the difference. What I am after using the first line as an example is for D to equal zero, what is happening is .00000249 is being subtracted from L (or M) 0.00001957 on the next iteration, (i =1) to give -0.00001708 when that too should be zero. I cannot fathom why this is happening. As previously mentioned, I am very new to this so have probably missed something very fundamental.
Thank you for your help


Viewing all articles
Browse latest Browse all 81803

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>