for (..of..), getters and setters now added to Espruino #156
gfwilliams
announced in
News
Replies: 3 comments
-
Posted at 2018-05-25 by J{a}SON nice! |
Beta Was this translation helpful? Give feedback.
0 replies
-
Posted at 2018-05-25 by @joakim Nice! That was quick :) |
Beta Was this translation helpful? Give feedback.
0 replies
-
Posted at 2018-05-27 by sys It's good news! Thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Posted at 2018-05-25 by @gfwilliams
I've just added the following to cutting-edge Espruino builds. These will be shipped in Espruino releases 1v100 and later (1v99 doesn't have them):
for (..of..)
This is a nice way of iterating over array/object properties, and will support iterators in the future. It's a more sane version of
for (..in..)
that returns values not keys, and that doesn't iterate over inherited properties.Getters and setters
You can now call a function when a value is read or written in an object. These work in normal object definitions:
Using the old
defineProperty
way:Or even inside the new classes:
Beta Was this translation helpful? Give feedback.
All reactions