05-20-2020 16:32
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-20-2020 16:32
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Given this array:
const FIB_SEQ = [0, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89];
shouldn't this work?
const found = FIB_SEQ.find((element) => element > 45);
The error I'm getting is "App: Unhandled exception: TypeError: Expected a function."
I tested this in a code playground and it works as expected there. Is there some limitation in the FitBit implementation of JS? I feel like I'm missing something very simple here... having the same problem with array.indexOf as well.

05-20-2020 16:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


05-20-2020 16:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
On the watch, you have to limit yourself to ES5.1 (mostly).
Gondwana Software
05-21-2020 05:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-21-2020 05:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Ah, okay. Thank you!
You said, "mostly..." Is there a guide to what is/isn't actually available?

05-21-2020 13:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


05-21-2020 13:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I don't know of any reference on that, although it would be good to have.
There is some support for async/await and fetch.
Gondwana Software

05-21-2020 21:11
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-21-2020 21:11
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
@Gondwana wrote:I don't know of any reference on that, although it would be good to have.
There is some support for async/await and fetch.
Yes, mostly I just try it. They've actually implemented more than they've documented, though there are some idiosyncrasies.
On a positive note, if the results seem weird there's usually some information in the SDK forum about it.
05-25-2020 01:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-25-2020 01:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Just to point some official documentation:
https://dev.fitbit.com/build/guides/application/#javascript
There it says it's ES5, with the JerryScript engine https://github.com/jerryscript-project/jerryscript
As you noticed there are also some additions like Promises
