pass an array twig to javascript : I have a packages array in my twig file. I want to send this array to javascript but have this error  (Array to String Conversion).

This is my code
     

     //packages array from model
    {{packages}}
    
    //javascript
    const myArray = '{{ packages[0] }}';
    console.log(myArray);
