I am relatively new with ES6 and I have a large PHP project where all view pages are .php files. Almost all files have it's own JS code, and I was wondering if it is possible somehow to write ES6 features inside those files, for example:
<body>
<?= $this->username ?>
...
<script>
const sum = (n1 = 0, n2 = 0) => n1 + n2
</script>
</body>
I know some browsers can interpret it (Chrome etc), but others can't (Internet Explorer).
There is any way to transpile ES6 to ES5 inside these files or should I write ES6 features in a separated .js file and then transpile it?