or parse the json string using JSON.parse()
var array = JSON.parse('{{ json_encode($yourarray) }}');
2. You can use laravel json directive
var app = @json($yourarray);
It's very convenient
3. Curly braces and exclamation marks
var array = {!! json_encode($yourarray) !!};
4. Json parse and encode together
var array = JSON.parse('{!! json_encode($yourarray) !!}');
5. With PHP tag
var app = <?php echo json_encode($yourarray); ?>;