Efficient way to call jquery method in jaggerry

100 views Asked by At

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.

1

There are 1 answers

0
Govinnage  Rasika Perera On

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