Toggle navigation
Genres
Frontend (2)
JavaScript (6)
Database (2)
Linux Server (3)
Web Apps (4)
Misc (4)
Search
List
New Tutorials
Last Modified Tutorials
</>
Code examples
code
smiko
javascript
advanced
variables
05var_string_object.js
05var_string_object.js
/** * When we try to apply method to primitive data type, * string is automatically converted into object. After method finish its job * string primitive data type is returned. */ var name = 'John'; /** * Process of using string data type as an Object * 1. converts name into Object * 2. method toUpperCase() execute operation * 3. Object is destroyed and name2 becomes string again */ var name2 = name.toUpperCase(); var type1 = typeof name; var type2 = typeof name2; console.log('name data type: '+type1+' - '+name); console.log('name2 data type: '+type2+' - '+name2);
Reload page
Preview
W3C validation
Edit Code
JS Console