How do i assign a js variable a php value, for example i have this js variable called nr and a php var $nr.
@php
$gal = \App\Gallery::where('id',$wid[1])->first();
$p = json_decode($gal->photo,true);
$nr = count($p);
@endphp
<script>
var nr={PHP variable here};</script>