You are almost right. There is something called autoboxing (wrapping primitives in objects) http://princepthomas.blogspot.com/2011/07/auto-boxing-javascript-primitive-types.html
edit: sory for duplication of Mike Christensen link - I did not notice it.