As we learned in the previous chapter, server-side scripts can use the putClientData() method of the GlideSession API (accessible by using gs.getSession()) to associate a value with the user's session, so that the data can be accessed from client scripts using g_user.getClientData(). This method accepts one argument: the key (which must match the key of some data associated with a user's session from a client script that ran prior to the current page loading). getClientData() returns the string value associated with that key.
var clientDataVal = g_user.getClientData('key');