parseInt(x, 10);

FYI- http://davidwalsh.name/parseint-radix <- is fairly good at explaining this I think