It's even worse than it appears.
Thursday September 17, 2020; 10:36 AM EDT
  • I believe self-executing functions in JavaScript are obsolete with ES6. I never liked and rarely used them. I prefer to use features put there by the designers, rather than use a clever hack that makes you wonder why the feature wasn't put there. #
  • Now in ., you can create a simple block and declare your variables with let. No clever hacks needed. #
  • Some real-world example code.#
    • { //insert headline for 1st level subs#
      • let htmltext = "";#
      • let ixButtonsArray = ix + 1; #
      • let theButton = theButtons [ixButtonsArray];#
      • function div (classname, val) {#
        • return ("<div class=\"" + classname + "\">" + val + "</div>");#
        • }#
      • function add (s) {#
        • htmltext += s;#
        • }#
      • add (div ("divButtonEmoji", theButton.htmlEmojiCode));#
      • add (div ("divButtonTitle", theButton.theTitle));#
      • add (div ("divButtonVal", ix));#
      • opInsertRawHtml (htmltext, right);#
      • }#
  • The block, like a bundle in Frontier, allows you to collapse some code, hide its variables from the containing code, without declaring a new routine. It's essential that you put a comment at the opening left curly brace to say what the block does. If that's not easy to do that indicates a refactor is needed, imho.#

© 1994-2020 Dave Winer.

Last update: Thursday September 17, 2020; 9:17 PM EDT.

You know those obnoxious sites that pop up dialogs when they think you're about to leave, asking you to subscribe to their email newsletter? Well that won't do for Scripting News readers who are a discerning lot, very loyal, but that wouldn't last long if I did rude stuff like that. So here I am at the bottom of the page quietly encouraging you to sign up for the nightly email. It's got everything from the previous day on Scripting, plus the contents of the linkblog and who knows what else we'll get in there. People really love it. I wish I had done it sooner. And every email has an unsub link so if you want to get out, you can, easily -- no questions asked, and no follow-ups. Go ahead and do it, you won't be sorry! :-)