How to convert an array from php Laravel to javascript

If you have an array from php (maybe a collection from DB) and you want to use this data in Javascript, a simple solution would be

var jsArray = @json($array);

Leave a Reply

Your email address will not be published.