Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



#javascript #object #string #syntax

In contexts where a method is to be invoked on a primitive string or a property lookup occurs, JavaScript will automatically wrap the string primitive and call the method or perform the property lookup.

 var s_prim = 'foo' ; 
 var s_obj = new String ( s_prim ) ;
 console . log ( typeof s_prim ) ; // Logs "string"
 console . log ( typeof s_obj ) ; // Logs "object" 
If you want to change selection, open document below and click on "Move attachment"

String - JavaScript | MDN
g calls in a non-constructor context (i.e., without using the new keyword) are primitive strings. JavaScript automatically converts primitives to String objects, so that it's possible to use String object methods for primitive strings. <span>In contexts where a method is to be invoked on a primitive string or a property lookup occurs, JavaScript will automatically wrap the string primitive and call the method or perform the property lookup. var s_prim = 'foo'; var s_obj = new String(s_prim); console.log(typeof s_prim); // Logs "string" console.log(typeof s_obj); // Logs "object" String primitives and String objects also give different results when using eval() . Primitives passed to eval are treated as source code; String objects are treated as all ot


Summary

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Details



Discussion

Do you want to join discussion? Click here to log in or create user.