I am calling a function when the window is resized like this:
window.addEventListener(\"resize\", calculateDimensions());
But I need a way
Use window.addEventListener("resize", calculateDimensions);
window.addEventListener("resize", calculateDimensions);
calculateDimensions() means that you execute the function and then use that result as a callback function.
calculateDimensions()