Message from JavaScript discussions

August 2017

— Yes I know those two little functions check the same thing twice, they are on the todo list


I can see cross sections of traversal state and see this right before I get errors about type, as some other functions require objects and throw TypeErrors.

— The upper props are from the previous iteration and get changed later execution, so ignore those

— But the bottom tuple prop shows the result of traversal

— It chokes on some polymorphic length checking function that fails to ID the tuple elements as objects

Message permanent page


function getContainerLength(input) {
if (Array.isArray(input)) {
return input.length;
if (input !== null && typeof input === "object") {
return Object.keys(input).length;
throw new TypeError("The given parameter must be an Object or Array");

Message permanent page

— The same check the other functions ran... but those did type the input as an object

— I know, but I don't use var anymore

— Because I only use the good parts of JS :)

— I redefined them

— Var can lead to unwanted behaviors, let is bound to its scope so it's just like a variable definition should be

Message permanent page

— It's not holywar it's just the right way to define variables