Unary Keyword Operator Sub-group
typeof
void
delete



Navigation Aids -- This Page        Navigation Aids -- This Topic        Navigation Aids -- This Site








Review of Terms Related to This Topic





The Purpose for this Page

This page will show the basic rules for the JavaScript keyword operator group. Some special situation cases are explained. And finally, some scripting examples are provided with comments.

The term "keyword group" used in this context is strictly arbitrary and unofficial. It is our term.





The Basics of Keyword Operators





Some Script Examples


Expression Giving Comment
var x = 4;
alert(typeof x);
number typeof
returns a string "number" indicating the type of data of x
var x = "4";
alert(typeof x);
string typeof
returns a string "string" indicating the type of data of x
var x;
alert(typeof x);
undefined typeof
declared but not initialized
var x = false;
alert(typeof x);
boolean typeof
returns a string "boolean" indicating the type of data of x
var a = new Array();
alert(typeof a);
object typeof
returns a string "object" for the Array
var a = void 7;
alert(typeof a);
undefined void
sets the value of "a" to undefined;
void discarded the assignment of 7
var a = new Array(4);
a[0] = "red";
delete a[0];
alert(a[0]);
undefined build an array with 1st element defined as "red"
delete will return true, the alert returns "undefined"
var astring = new String("help");
astring.friend = false;
delete astring.friend;
alert(astring.friend);
undefined build a string object with a property
delete will return true
var ob = new Object( );
ob.name = "aname";
delete ob.tostring;
error delete will return false
cannot delete a native (built-in) method or property


Top            

Rx4AJAX        About Us | Topic Index | Contact Us | Privacy Policy | 2008 This Site Built By PPThompson