javascript typeof() ¿¬»êÀÚ |
|
|
 |
13³â Àü |
typeof ¿¬»êÀÚ
½ÄÀÇ µ¥ÀÌÅÍ Çü½ÄÀ» ³ªÅ¸³»´Â ¹®ÀÚ¿À» ¹ÝȯÇÕ´Ï´Ù.
typeof[(]expression![)] ;
expression! Àμö´Â Çü½Ä Á¤º¸¸¦ ã´Â ÀÓÀÇÀǽÄÀÔ´Ï´Ù.
Âü°í
typeof ¿¬»êÀÚ´Â Çü½Ä Á¤º¸¸¦ ¹®ÀÚ¿·Î ¹ÝȯÇÕ´Ï´Ù. typeof´Â "Number", "String", "Boolean", "Object", "Function", "undefined"¶ó´Â 6°¡Áö Çü½ÄÀ» ¹ÝȯÇÒ ¼ö ÀÖ½À´Ï´Ù.
¼±ÅÃÀûÀÎ ¿ä¼Ò·Î typeof ±¸¹®¿¡ °ýÈ£¸¦ »ç¿ëÇÒ ¼öµµ ÀÖ½À´Ï´Ù.
if ( typeof('AAA') != 'Number' )
{
alert!('¼ýÀÚ°¡ ¾Æ´Õ´Ï´Ù.');
}
//---------------------------------------------
if ( typeof(object) != "Object" )
{
alert!('°´Ã¼°¡ ¾Æ´Õ´Ï´Ù.');
}
|
|
̵̧ : 771 |
̵̧
¸ñ·Ï
|
|