How to get to Model or Viewbag Variables in a Script Tag in Asp.Net MVC

How to get to Model or Viewbag Variables in a Script Tag in Asp.Net MVC

 

var val = parseInt(@ViewBag.ForSection);
var val = '@ViewBag.ForSection';
alert(val);
<script>

     $('#Add_Submit').click(function (e) {

         var val = @ViewBag.Number;
         alert(val);

     });
</script>

2020-06-04