Message from JavaScript discussions

August 2017

— 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

— 

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

— My boss just did this:

mounted: function () {
this.background = this.$el.querySelector('.stories-background')
this.stories = this.$el.parentElement.querySelector('.stories')

in a vue component. You can reference $el inside a component, that does not mean it's good. It leads to unwanted behaviors (as it is and that it's why I am refactoring this)

Message permanent page

— Oh christ

— YEP