Need help with Custom JS

I’m trying to set a javascript variable that denotes whether a user is logged in. Can you help me with the custom JS code for it?