I often need to work with data client side that is returned from the server. Found this neat piece of code which I used to get the available mimetypes so I can validate client side that the file the user is attempting to upload is accepted.
$php_array = get_allowed_mime_types();
$js_array = json_encode($php_array);
echo "var mimetype_array = ". $js_array . ";\n";