JavaScriptÖÐnull, undefined µÄÉîÈë̽ÌÖ
null, undefined
Ïàͬ£º
µ±Ò»¸ö±äÁ¿µÄÖµÊÇnull, undefinedʱ£¬±íʾ£ºÎÒÃÇÉùÃ÷²¢¶¨ÒåÁËÒ»¸ö±äÁ¿£¬½ö½öÊÇÕâ¸ö±äÁ¿µÄÖµÊÇnull, undefined.
±»µ÷ÓÃÕߣº
½«null, undefined×÷Ϊ²ÎÊý´«Èë"JavaScriptÄÚÖú¯Êý"ʱ£¬²»»á³öÏÖÒì³££¬ÄÚÖú¯Êý·µ»Ø£ºnull -> null, undefined->undefined
µ«typeofº¯Êý³ýÍâ¡£
µ÷ÓÃÕߣº
ÔÚnull, undefinedÉϵ÷ÓÃÊôÐÔ£¬·½·¨»á³öÏÖÒì³£¡£
²»Í¬£º
ÌØÊâµÄtypeofº¯Êý£¬ typeof null -> "object" typeof undefined -> "undefined"
Ìرð×¢Ò⣺
ÔÚJavaScriptÖУ¬Èç¹ûÒ»¸ö±äÁ¿Ã»ÓÐÉùÃ÷£¬Ò²¾ÍÊDz»´æÔڵġ£
±»µ÷ÓÃÕߣº
½«Ã»ÓÐÉùÃ÷µÄ±äÁ¿×÷Ϊ²ÎÊý´«Èë"ÈÎÒâµÄJavaScriptº¯Êý"ʱ£¬»á³öÏÖÒì³££¬µ«typeofº¯Êý³ýÍâ¡£
µ÷ÓÃÕߣº
ÔÚûÓÐÉùÃ÷µÄ±äÁ¿Éϵ÷ÓÃÊôÐÔ£¬·½·¨»á³öÏÖÒì³£¡£
ÌØÊâµÄtypeofº¯Êý£¬ ¶ÔÒ»¸öûÓÐÉùÃ÷µÄ±äÁ¿£¬ÀýÈ磺undeclared, typeof undeclared : ·µ»Ø "undefined".
Òò´Ë¶ÔÒ»¸ö±äÁ¿µ÷ÓÃtypeof ·½·¨ÊÇ×î±£Ïյġ£ÀýÈç±È½ÏÒ»¸ö±äÁ¿book, µ÷Óà book == null , book == undefined £¬
Èç¹ûbook±äÁ¿Ã»ÓÐÉùÃ÷£¬Ôò³öÏÖÒì³££¬µ«ÊÇtypeof book Ôò²»»á³öÏÖÈκÎÒì³£¡£
º¯ÊýµÄ²ÎÊý£¬ºÍ¶ÔÏóµÄÊôÐÔ£¬ÊôÓÚÒѾÉùÃ÷µÄ±äÁ¿¡£
¶ÔÓÚûÓÐÉùÃ÷µÄ±äÁ¿£¬³ýtypeofº¯ÊýÖ®Í⣬ ÆäËüµÄÈκβÙ×÷£¬¶¼»á³öÏÖÒì³£¡£
¶ÔÓÚÒѾÉùÃ÷µÄ±äÁ¿£¬Êµ¼ÊËüÒѾÊÇ´æÔÚ£¬ÆäÖµÐèÒªÇø·Önull, undefined, instance(ʵÀý)¡£
µ÷ÓÃÕߣº
ÔÚnull, undefinedÉϵ÷ÓÃÊôÐÔ£¬·½·¨»á³öÏÖÒì³£¡£
ÔÚinstanceÉϵ÷Óò»´æÔÚµÄÊôÐÔ£¬²»»á³öÏÖÒì³££¬ÒòΪ¶ÔÏóµÄÊôÐÔ¶¼ÊÇÒѾÉùÃ÷µÄ±äÁ¿£¬
µ«Êǵ÷Óò»´æÔڵķ½·¨£¬Ôò³öÏÖÒì³£¡£
Ïà¹ØÎĵµ£º
Ç°¼¸Ì죬ÔÚͼÊé¹Ý¿´ÁËÒ»±¾Êé½Ð¡¶JavaScript Dom ±à³ÌÒÕÊõ¡·´ÓÖг¢µ½ºÜ¶à֪ʶ»òÕß³ÆÆäΪ·½·¨£¬ÓÉÓÚÒ»Ö±ÔÚ棬ûÓÐʱ¼äд³öÀ´·ÖÏí¸ø´ó¼Ò£¬½ñÌìÕýºÃÓеãʱ¼äËùÒÔ¾Íд³öÀ´°É£¬Õâ±¾ÊéµÄ×÷ÕßJeremy Keith ÎÒÒÔǰûÓÐÌýµ½¹ýÕâ¸öÈË£¬´ËÊéÖоÍÒ»¶Î»°ÊÇ˵“ÎÞÂÛºÎʱµØ£¬¶¼Òª°Ñ‘ÑÐò½¥½ø’ºÍ ......
//ÓÉÒ³ÃæÔªËØdate_string(YYYY-MM_DD¸ñʽ)µÃµ½Êý×édate_array
//ÊäÈë²ÎÊý£ºdate_string:ÈÕÆÚ´®£»marker:ÈÕÆÚ´®date_stringÀïµÄ·Ö¸ô·û£¬Èç¹ûûÓÐÔòΪ""£»
//·µ»ØÖµ£º Êý×飺date_array
// Êý×éÔªËØdate_array.year=YYYY£»dat ......
URL±àÂë·½·¨µÄ±È½Ï javascriptÖдæÔÚ¼¸ÖÖ¶Ô Technorati ±êÇ©: JavaScript,url,±àÂë URL×Ö·û´®½øÐбàÂëµÄ·½·¨£ºescape()£¬encodeURI()£¬ÒÔ¼°encodeURIComponent()¡£Õ⼸ÖÖ±àÂëËùÆðµÄ×÷Óø÷²»Ïàͬ¡£ escape() ·½·¨£º ²ÉÓÃISO Latin×Ö·û¼¯¶ÔÖ¸¶¨µÄ×Ö·û´®½øÐбàÂë¡£ËùÓеĿոñ·û¡¢±êµã·ûºÅ¡¢ÌØÊâ×Ö·ûÒÔ¼°ÆäËû·ÇASCII×Ö· ......
ugmbbc·¢²¼ÓÚ 2009-11-14 09:41:43| 7628 ´ÎÔĶÁ ×ÖÌ壺´ó С ´òÓ¡Ô¤ÀÀ
var ReTitle = '»Ø¸´:Google ÅÅÃûÖÐµÄ 10 ¸ö×îÖøÃûµÄ JavaScript ¿â';
¸ÐлCOMSHARP CMSµÄͶµÝ
ÐÂÎÅÀ´Ô´:tripwiremagazine.com
JavaScript ÊÇ Web ¿ª·¢ÓëÉè¼ÆÖв»¿É»òȱµÄ¶«Î÷£¬²»¹ÜÊÇÒ»¸ö¼òµ¥µÄÍøÒ³»¹ÊÇÒ»¸öרҵµÄÕ¾µã£¬Ò²²»¹ÜÄãÊǸßÊÖ»¹ÊDzËÄñ ......