Message from JavaScript discussions

July 2017

— But I normally use for..of anyway

— 

I need it because the functions in cdaTemplate are polymorphic, can use Arrays or NodeLists, and NodeLists have values()

— Instead of branching or setting up new boilerplate to handle the Arrays, I can just use the same code now :D

Message permanent page

— Specifically, insertTemplate accepts a variable, destElems which can either be a 1-item array like this: [Node] or a NodeList full of Nodes

Message permanent page

— 

var destElems = [document.querySelector(destSel)];

versus
var destElems = document.querySelectorAll(destSel);

Message permanent page

— And, then in use:

// Iterate through the destinations for insertion

for (var destElem of destElems.values()) { ...

Message permanent page

— Ultimate root cause of the need is due to NodeList's abstract nature, it requires you to use an iterator because it is a "view" on the DOM which is a graph structure, and does not "contain" any Nodes itself

Message permanent page

— That is what iterators are great for, abstracting complex data structures into an interface presented linearly

Message permanent page

— Send your CV to iurii_buraepam.com, I'll forward it :)

— Which region is that,,?

— Well I'm not headhunting or advertising :) please keep in mind :) The company that I work for - EPAM Systems has quite a few offices around the globe, most of them in Europe, couple in China, US. There's one in Mexico too

Message permanent page

— Always wanted to go for few weeks to Mexico.