Use modern JS features

Since we run in a modern JS environment we are allowed to take advantage
of newer JS stuff like for..of-loops (loops over iterables) and
arrow-functions (anonymous functions that has lexical binding of
'this').

This patch makes us use the features mentioned above.

https://bugzilla.gnome.org/show_bug.cgi?id=722758