Concise alternative to javascript switch
PandaUploader.getHttpStatusText = function(statusCode) {
return {
400: "Bad Request",
401: "Unauthorized",
404: "Not Found",
412: "Precondition Failed",
415: "Unsupported Media Type",
500: "Internal Server Error"
}[statusCode*1]
};
The *1 forces statusCode to a number and looks up the corresponding string value in the json object.