I recently came upon some code that I wrote about ten years ago. Back then, I was helping to set up a church hall for a Bingo game, and realized that they didn’t have one of those big display boards with lights and switches to let people know what numbers had already been called. There […]
Tag Archives: Javascript
Arrow Functions in ES6
Arrow functions have been introduced to Javascript as a more concise way to write function expressions. Here are some examples of the syntax. Instead of this old-style regular function we can write We can drop the function keyword, and if just returning an expression, we can drop the return keyword, too. If there is only […]
ES6 Content Literals
The Data Storage custom Drupal module uses Javascript to dynamically generate HTML to present a variable number of questions and services. Writing HTML is Javascript has always been pretty clunky, full of hard to read expressions like this: For heavier template lifting, I’ve been using the Mustache Javascript library. Templating libraries like Handlebars (which I […]
Rest and Spread
Rest and spread are two new operators in the new ES6 (ECMAScript 6) standard which Javascript implements. Javascript development in Drupal 8 Core is now done in ES6. See: https://www.drupal.org/node/2815083 Both Rest and Spread are represented with 3 dots (…). REST (“the rest of the parameters”) is used in function calls where you want to treat an […]