Jason Knight
Dec 14, 2022

--

Make the function a const

const myFunction = function(test) { console.log(test); }

or when you can get away with arrow:

const myFunction = (test) => console.log(test);

And it'll scope. You've probably been seeing more and more people writing their functions this way... that's why.

--

--

Jason Knight
Jason Knight

Written by Jason Knight

Accessibility and Efficiency Consultant, Web Developer, Musician, and just general pain in the arse

Responses (1)