Home > Back-end >  How does a function work inside the push method?
How does a function work inside the push method?

Time:01-09

I have 2 questions.

  1. Regarding var Webflow = Webflow || [];, what is the purpose of setting the variable to have the OR operator with a blank array?

  2. Regarding the push method that follows ( Webflow.push(function() {...), how/why is there a function created inside the push method. I understand the push method is used to add items to an array, but I can't find much info online about how it works when you put create a function inside the push method. Does it ultimately make the original variable "Webflow = Webflow OR [result of the final function]?

I hope my questions are clear enough. Any insight or clarity, even if it doesn't directly answer my questions would be helpful. My goal is to fully understand every line of this code. Thank you!

  • Related