Ah, I see now what's going on.
While "workspace" would be a good word, I didn't quite get what you did to get the problem you described. I now understand that you were uploading/downloading your "folder" (in ND1 speak).
Ok, here's your corrected code:
- Code: Select all
var s2 = Date.parse ( Date() )
var s1 = Date.parse ( "April 13, 1960 13:01:00 GMT-0400 (EDT)" )
var dayDiff = Math.abs(Math.round((s2-s1)/86400000))
There's no function name.
var is used to define each local variable used.
(These are basically the same notes as above.)
You hit a real bug that only occurs if you name your function. That is, don't name your function and everything will be fine.
Uploading had nothing to do with the bug, but switching back to the calculator had.
If you're curious, here's what happens internally and an explanation for what you saw: when you store a function, it's parsed and made live in the calculator run-time. The parsing ignores any given function name. Also, the original function text is stored into a database.
Whenever you switch back to the calculator (and it doesn't matter, if you're coming from My Data
, or doing a fresh start of the calculator), the contents of the database are made live in the run-time. Now, the code that does that, does not ignore a given function name. Instead, it considers the given definition as faulty and just installs it as text. That's why the text of the function is shown to you when you attempt to execute it. (No error msg is given during database-to-run-time conversion, because if you had many "bad" functions like that, you'd be swamped with messages.)
So, what I'll do for the next version is flag an error when a named function is entered. That way no named functions can make it into the database.
Thank you for reporting this! I can see now how this can easily