һЩС֪ʶ×ܽᣨËäÈ»¿ÉÄÜûÓã©

2019-01-15 07:02:06À´Ô´£º²©¿ÍÔ° ÔĶÁ ()

ÐÂÀÏ¿Í»§´ó»ØÀ¡,ÔÆ·þÎñÆ÷µÍÖÁ5ÕÛ

1¡¢typeof¿ÉÒÔÓÃÓÚ䶨ÒåµÄ±äÁ¿

1 var a;
2 alert(typeof a);
3 alert(typeof b);

ÉÏÃæµÄ´úÂëÊä³ö½á¹ûÏàͬ£¬typeof²»Çø·Ö䶨Òå±äÁ¿ºÍδ³õʼ»¯±äÁ¿£¬ËüÃǵķµ»ØÖµ¶¼Îªundefined¡£

2¡¢undefinedʵ¼ÊÉÏÊÇ´ÓnullÅÉÉú³öÀ´µÄ£¬ÔÚECMA±ê×¼ÖÐÈÏΪ¶þÕßÏàµÈ£¬¼´undefined==nul --------->true

3¡¢¸¡µãÊýÔò»á½øÐмÆËã֮ǰÊÇÒÔ×Ö·û´®ÐÎʽ´æ´¢µÄ

4¡¢NaN×ÔÉíÊDz»ÏàµÈµÄ£¬¼´NaN==NaN -------->false

5¡¢»ñÈ¡·¶Î§ÔÚmin~maxÖ®¼äµÄËæ»úÊý

1 Math.floor(Math.random() * (max - min + 1) + min);

6¡¢Êý×éÖÐÈ¡×î´óÖµµÄ·½·¨

1 Math.max.apply(Math,arr);

µ«ÊDz¢Ã»ÓÐÈ¡Êý×é×îСֵµÄ·½·¨

7¡¢toString()·½·¨¿ÉÒÔ½«ÆäËüÀàÐ͵ÄֵתΪStringÐÍ£¬Õâ¸ö·½·¨À´Ô´ÓÚObject£¬ËùÒÔString±¾ÉíÒ²ÓÐÕâ¸ö·½·¨£¨ËäÈ»×Ö·û´®×ª×Ö·û´®ºÃÏñºÜ´À¡£¡£¡££©

8¡¢NumberµÄtoString()·½·¨¿ÉÒÔ´«Èë»ùÖµ£¬ÒÔ½øÐнøÖÆת»»

1 var num = 10;
2 alert(num.toString(2));    //Êä³ö "1010"
3 alert(num.toString(8));    //Êä³ö "12"
4 alert(num.toString(16));   //Êä³ö "A"

 


Ô­ÎÄÁ´½Ó:https://www.cnblogs.com/voidchar/p/10265106.html
ÈçÓÐÒÉÎÊÇëÓëÔ­×÷ÕßÁªÏµ

±êÇ©£º

°æȨÉêÃ÷£º±¾Õ¾ÎÄÕ²¿·Ö×ÔÍøÂ磬ÈçÓÐÇÖȨ£¬ÇëÁªÏµ£ºwest999com@outlook.com
Ìرð×¢Ò⣺±¾Õ¾ËùÓÐתÔØÎÄÕÂÑÔÂÛ²»´ú±í±¾Õ¾¹Ûµã£¬±¾Õ¾ËùÌṩµÄÉãÓ°ÕÕƬ£¬²å»­£¬Éè¼Æ×÷Æ·£¬ÈçÐèʹÓã¬ÇëÓëÔ­×÷ÕßÁªÏµ£¬°æȨ¹éÔ­×÷ÕßËùÓÐ

ÉÏһƪ£ºjsÖ®·µ»ØÍøÒ³¶¥²¿

ÏÂһƪ£ºjsÈçºÎÉú³ÉidËæ»úÊý