I'm having some trouble using custom JavaScript function within Laravel 5.6 and can't figure out what I'm doing wrong.
I have a custom file created in /assets/js/ labeled helpers.js with the following function:
export const isBetween = function(n, a, b) {
return (n - a) * (n - b) <= 0
};
Then, in app.js I imported the file:
import { isBetween } from './helpers.js';
If I do console.log(isBetween(20, 1, 40) inside app.js, it works properly. However, I can't execute inside my blade template; the console log says it's not defined. E.g.:
<script type="text/javascript">
jQuery(document).ready(function($) {
console.log(isBetween(20, 1, 40));
});
</script>