Reputation: 7983
I want to use this jquery function inside my jaggery file:
$.inArray(value, array)
What is the most efficient way of doing it?
Jquery is already imported in the file using a <script>
tag. I think using require()
function to again get jquery would be inefficient.
Upvotes: 0
Views: 99
Reputation: 2254
You cannot use jQuery in JaggeryJs. Jaggery is designed to run at the server side(Internally uses Rhino Engine). Unless there's a jQuery library for server side scripting you won't be able to do this.
As an alternative you could do something like this;
[1, 2, 3].includes(2); // true
[1, 2, 3].includes(4); // false
[1, 2, 3].includes(3, 3); // false
Upvotes: 0