Accessing objects in client side javascript in jade

In express if I passed an object into an jade file like so

res.render("index",{name : "Kerrigan"});

I can access the name property of the literal object in index.jade like this

p My name is #{name}

However in order to access the literal object in a client side script I would have to initially do this.

script(type="text/javascript").
  name = !{JSON.stringify(name)};
  //now I can use the name variable
  alert(name);

So my question is what does the !{JSON.stringify(name)} line do, and how is the ! operator being used here?
I am new to express and javascript, so I believe it has something to do with how the res.render function sends the object to jade.

You don't access the object from the client side javascript, you inject the value of the object in the script. You should have a look at the generated page to see this point.

I wish I could point you the documentation of !{}, but it seems there is no documentation on that one ...

!{expression} injects the value of the expression, not escaped (the meaning of ! in jade in unescaped). #{expression} does the same thing but escape the value.