@DarkMahesvara This article demonstrates XSS attack with a SVG file: https://rietta.com/blog/svg-xss-injection-attacks/. If user opens attached SVG file with a malicious script, the script gets executed and it will have access to local storage under the same domain.
That being said, I don't know how one can perform this attack with plain JS file. Probably there was some additional step.