Primitive wrapper class

The Boolean type, the Number type, and the String type has their own wrapper class. The wrapper types can act like the other reference types.

A primitive value is created along with an object of the corresponding primitive wrapper type.

 
<!DOCTYPE html>
<html>
<head>
    <title>Example</title>
    <script type="text/javascript">

        var s1 = "some text"; 
        var s2 = s1.substring(2); 
       
    </script>
</head>
<body>
</body>
</html>
  
Click to view the demo
Home 
  JavaScript Book 
    Language Basics  

Primitive Wrapper Class:
  1. Primitive wrapper class
  2. Object constructor acts as a factory method for primitive data types
  3. primitive wrapper constructor vs casting function