Cast all sorts of JavaScript values to specific types