Blog Post

Daisy Chains, the Undead, and JavaScript Functions

JavaScript processes functions, and so on, from the left, so, while you can do it in multiple lines like a horde spreading out in ranks, you could also daisy chain functions together like:

document.getElementById("list").appendChild( listOfHumanRefuges );

JavaScript will take the document object and run the getElementById on it. When getElementById returns an element, it’ll then run appendChild on that element. If this is still confusing or makes less sense to you, there’s no need to worry about it. Structure your code whatever way makes sense to you and whatever way will make sense to whomever looks at it later (including and especially future you).