JavaScript_Succinctly
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Sample: sample12.html<br />
<br />
var myString = 'string'<br />
var myNumber = 10;<br />
var myBoolean = false; // Could be true or false, but that is it.<br />
var myNull = null;<br />
var myUndefined = undefined;<br />
console.log(myString, myNumber, myBoolean, myNull, myUndefined);<br />
/* Consider that a complex object like array or object can be made up of<br />
multiple primitive values, and thus becomes a complex set of multiple values.<br />
*/<br />
var myObject = {<br />
myString: 'string',<br />
myNumber: 10,<br />
myBoolean: false,<br />
myNull: null,<br />
myUndefined: undefined<br />
};<br />
console.log(myObject);<br />
var myArray = ['string', 10, false, null, undefined];<br />
console.log(myArray);<br />
<br />
Quite simply, primitive values represent the lowest form (i.e. simplest) of data and<br />
information available in <strong>JavaScript</strong>.<br />
Notes<br />
As opposed to creating values with literal syntax, when a String(), Number(), or<br />
Boolean() value is created using the new keyword, the object created is actually a<br />
complex object.<br />
It’s critical that you understand the fact that the String(), Number(), and Boolean()<br />
constructors are dual-purpose constructors used to create literal/primitive values as well<br />
as complex values. These constructors do not always return objects, but instead, when<br />
used without the "new" operator, can return a primitive representation of the actual<br />
complex object value.<br />
29