How do you pass a global merge field type $User into javascript?
I'm able to pull the User First Name into the HTML with the below HTML, but I would like to pass the User First Name into the Javascript within Visualforce.
How would I go about doing that? I've tried the below, but I get the following error:
Uncaught ReferenceError: Chris is not defined
Chris is my name which I want it to alert me of. I've tried to turn this into a string with no luck either.
Below is what I'm trying
<apex:page >
<html>
<body>
<div>
Hello {!$User.FirstName}
</div>
<script>
alert(!$User.FirstName)
</script>
</body>
</html>
</apex:page>