My Function

This function is from my 2nd studio from 157a. It is part of a larger function that helps reset the variables as the image scale and repositions itself on scroll.

Named Function

            posts.forEach(function(post) {
                postTops.push(Math.floor(post.getBoundingClientRect().top) + window.pageYOffset);
            });
        

Function Expression

            const posts.forEach = function(post) {
                postTops.push(Math.floor(post.getBoundingClientRect().top) + window.pageYOffset);
            };
        

Arrow Function

            posts.forEach( post => {
                postTops.push(Math.floor(post.getBoundingClientRect().top) + window.pageYOffset);
            });