AMP is built for fast loading pages and if you use JavaScript and executing JavaScript in AMP pages will slow down AMP fast loading pages.