No, you can't assign javascript variables to C# variable. Because razor variable are server variables but javascript variables are client side variable.
When the server gets a request for a view, it creates the view with only HTML, CSS and Javascript code. The Javascript code do exist when the view is still on the server, it will be executed by the browser only (Client side again). It is meaning less.
Yes, you can assign server variables to javacript:
<script> var myJsVariable = '@ViewBag.MyVariable' </script>