Ublock origin (in advanced mode), umatrix, and noscript each enable this functionality. Umatrix has the best UI of the three once you get used to it in my opinion. Go on YouTube and look for "the hated one" for great tutorials on JS blocking with umatrix and ublock origin.