Skip to content

Tag: hoisting

Push to array and convert to string

I need to pass a value as a string and not an array from inside an event listener to a global variable. Currently when the page loads, I check for a cookie inside the event listener and pass that value (‘de’, ‘es’, ‘en’ etc) to an empty array. I don’t know a better wa…

Variable Hoisting in Javascript List of Adders

I have learned the basics of variable hoisting in JavaScript, and am now trying to enhance it by doing some exercises. I’ve come across this piece of code: This code first creates an array of functions from a given list. Each function adds the same passed number (in this case 100) to a particular value …