Sunday, November 4, 2018

I saw four lightning talks at JavaScript MN on Halloween night and appropriately the first and best was on spooky JavaScript.

Jonathon Stierman, who actually works at space150 which now hosts JavaScript MN, gave a talk called Spooky Weird Fun JavaScript. He went into a lot of the type coercion wackiness. Anything may be coerced into Boolean form for a truthy or falsey check obviously. Some specific results are scary. This is true for example:

if ("" == 0) {

 
 

This should only scare you if you are a noob as herein we are comparing values and not types as we would if we were using the strictly equals operator with three equal signs in lieu of the equality operator with two equals signs. This however will be false which is rather terrifying:

if (new String('Hello')===new String('Hello')){

 
 

Boolean operations do not always return Booleans. For example our variable here will end up with 42 in it:

const notaBoolean = (true && 42);

 
 

There is a mystical (Jonathon's term) thing called the AIS which stands for automatic semicolon insertion. You cannot really break the return keyword and the value to be returned (followed by a semicolon) onto two separate lines of code in JavaScript and expect it to behave as just one line of code as though the semicolon you can see with your own eyes denotes the end of the one line. Instead an implicit semicolon will be placed after the return keyword in this circumstance sabotaging what you are attempting. The return keyword and the thing to be returned have to sit on the same line together in JavaScript. There is no way to turn the AIS off. This is also why an open curly brace must immediately follow an if statement on the same line instead of being the first character of a new line as is the preferred convention in C#. jjencode was suggested to be an interesting obfuscation tool for JavaScript though frontend obfuscation is kinda silly. Jonathon showed us some examples of it and pretty much all of the human readable characters came out. Names were just made up of dollar signs and plus symbols and underscores.

Ja'keh Clark is a recent graduate of Prime Digital Academy, a coding boot camp, with a heavy prior history as a graphic artist who created an app called "The Loop" for one of his Prime projects. He showed it off in his talk and it is basically a let's-give-each-other-professional-references application. Of course this is a subset of what one may do already on LinkedIn but an emphasis of this talk was on how LinkedIn ain't all that. Ja'keh found it sanitized in a dehumanizing way and not really a venue for people to distinguish themselves or be more than résumés.

Arthur Taylor gave a talk on parsing big data with JavaScript. His example had to with going through loan data from quarter one of this year and determining who was thus worthy for another loan, i.e. who was a smart bet and a good investment. The Python pandas library was used in his work. It is for data analysis.

Michael de vera has a history in working with React Native, which really is what is sounds like, i.e. building native (Objective-C/Java/Swift) code for mobile devices by compiling JavaScript to it not unlike the Titanium of yore. He has been experimenting with Redux Thunk Middleware and what a thunk does is it allows you to call off to a handful of API calls at once while, instead of waiting for them all to return so that you may do something with all of the information, allowing you to react when the first/primary call returns, and then again when the secondary/silver call returns, and so on, etc. Without the thunk you have to make a recursion loop to constantly check if an object to be hydrated is not null for each of the steps to emulate this effect.

No comments:

Post a Comment