Here Mudassar Khan has explained with an example, how to get Session value in JavaScript or jQuery in ASP.Net Core MVC.
JavaScript is a Client Side language and hence directly it is not possible to get Session value in JavaScript.
Thus, the solution is to make an AJAX call using jQuery AJAX function and pass the value of JavaScript variable to a Controller and inside the Controller the value is retrieved from Session object in ASP.Net Core MVC.