Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javascriptÊý×é½éÉÜ

1          JavaScriptÊý×é¼ò½é
JavaScriptÊý×éÊÇÒ»ÖÖ°üº¬ÒѱàÂëµÄÖµµÄ¸´ºÏÊý¾Ý¡£Êý×éÇø±ðÓÚ¹ØÁªÊý×飬¹ØÁªÊý×éÊǽ«ÖµºÍ×Ö·û´®¹ØÁªÔÚÒ»Æ𣬶øÊý×éÊǽ«ÖµºÍ·Ç¸ºÕûÊý¹ØÁªÔÚÒ»Æð¡£
Êý×éÊǶÔÏó(¿ÉÀûÓÃtypeofÔËËã·û)¡£
2          Êý×éºÍÊý×éÔªËØ
2.1       ÔªËغÍϱêµÄ¸ÅÄî
Êý×éÊÇÒ»ÖÖÊý¾ÝÀàÐÍ£¬°üº¬»ò´æ´¢Á˱àÂëµÄÖµ¡£Ã¿¸ö±àÂëµÄÖµ¾Í½Ð×ö
Êý×éµÄÒ»¸öÔªËØ£¬Ã¿¸öÔªËصıàÂë¾Í½Ð×öϱꡣ
    ÓÉÓÚJavaScriptÊÇÒ»ÖÖÈõÊý¾ÝÀàÐÍ£¬ËùÒÔÊý¾ÝµÄÔªËØ¿ÉÒÔÊÇÈκεÄÊý¾ÝÀàÐÍ£¬°üÀ¨¶ÔÏó¡¢Êý×éµÈ¡£
2.2       Êý×éµÄ´´½¨
Êý×éÊÇÓù¹Ô캯ÊýArray()ºÍÔËËã·ûnew´´½¨µÄ¡£Äã¿ÉÒÔʹÓÃÒÔϼ¸ÖÖ·½Ê½À´´´½¨Êý×飺
2.2.1        ÎÞ²ÎÊýµ÷ÓÃ
var a = new Array();
2.2.2        Ã÷È·Ö¸¶¨Ç°N¸öÔªËصÄÖµ
var a = new Array(5, 4, 3, 2, 1, "testing");
2.2.3        ´«µÝÒ»¸öÊý×Ö²ÎÊý£¬Ö¸¶¨Êý×鳤¶È
var a = new Array(10)£¬ÔÚûÓи³ÖµÇ°Ã¿¸öÔªËصÄÖµ¶¼ÊÇundefined
2.2.4        Êý×éÖ±½ÓÁ¿
    var primes = [2, 3, 5, 7, 11];
var a = ['a', true, 4.78];
var b = [[1,{x:1, y:2}], [2, {x:3, y:4}]];
2.3       Êý×éÔªËضÁд
2.4       Ìí¼ÓÊý×éÐÂÔªËØ
Çø±ðÓÚC¡¢javaÊý×éµÄÔªËظöÊýÊǹ̶¨µÄ£¬ÔÚJavaScriptÖУ¬Êý×éµÄÔªËظöÊýÊÇ¿ÉÒÔÈÎÒâ¸Ä±ä¡£
JavaScriptÊý×黹ÓÐÒ»¸öÌص㣬¾ÍÊÇËüµÄÔªËØËù´æ´¢µÄÖµÔÚÄÚ´æÖв»Ò»¶¨ÊÇÁ¬ÐøµÄ£¬ÏµÍ³Ö»¶ÔÓд洢ÊýÖµµÄÔªËØ·ÖÅäÄÚ´æ¡£ÀýÈ磺a[0]=0,a[100]=’test’,ϵͳֻ¶Ô0ºÍ100ÕâÁ½¸öϱêµÄÔªËØ·ÖÅäÄÚ´æ¡£
2.5       Êý×éµÄ³¤¶È
ÔÚJavaScriptÖУ¬ËùÓеÄÊý×é(°üÀ¨Êý×éÖ±½ÓÁ¿)¶¼ÓÐÒ»¸öÊôÐÔlength£¬ÓÃÀ´ËµÃ÷Êý¾ÝÔªËصĸöÊý¡£ÀýÈ磺
<script type="text/javascript">
    var a = new Array(  );   //ûÓж¨ÒåÔªËØ
    document.write(a.length,'<br>');
    a = new Array(10);  &nbs


Ïà¹ØÎĵµ£º

JavaScript isNaN() º¯Êý


·µ»Ø JavaScript È«¾Ö¶ÔÏó²Î¿¼ÊÖ²á
¶¨ÒåºÍÓ÷¨
isNaN() º¯ÊýÓÃÓÚ¼ì²éÆä²ÎÊýÊÇ·ñÊÇ·ÇÊý×ÖÖµ¡£
Óï·¨
isNaN(x)
²ÎÊýÃèÊö
x
±ØÐè¡£Òª¼ì²âµÄÖµ¡£
·µ»ØÖµ
Èç¹û x ÊÇÌØÊâµÄ·ÇÊý×ÖÖµ NaN£¨»òÕßÄܱ»×ª»»ÎªÕâÑùµÄÖµ£©£¬·µ»ØµÄÖµ¾ÍÊÇ true¡£Èç¹û x ÊÇÆäËûÖµ,Ôò·µ»Ø false¡£
˵Ã÷
isNaN() º¯Êý¿ÉÓÃÓÚÅжÏÆä²ÎÊýÊÇ·ñÊÇ NaN£ ......

[JavaScript]ÀàÖ®Ò»

Ò»¸ö¼òµ¥µÄjavascriptÀඨÒåÀý×Ó
     º­¸ÇÁËjavascript¹«ÓгÉÔ±¶¨Ò塢˽ÓгÉÔ±¶¨Òå¡¢ÌØȨ·½·¨¶¨ÒåµÄ¼òµ¥Ê¾Àý
Java´úÂë
<script>     
    //¶¨ÒåÒ»¸öjavascriptÀà   
    function JsClass(privateParam/*&n ......

[JavaScript]ÀàÖ®¶þ

javascript ÀඨÒå4ÖÖ·½·¨
Java´úÂë
/*  
   ¹¤³§·½Ê½--- ´´½¨²¢·µ»ØÌض¨ÀàÐ͵ĶÔÏóµÄ ¹¤³§º¯Êý £¨ factory function £©   
*/  
    
  
function createCar(color,doors,mpg){   
   ......

JavaScript ÓÃÓÚģʽƥÅäµÄ RegExp ·½·¨

±¾ÆªÈÕÖ¾ÏÈÖ÷ÒªÌÖÂÛ RegExp ¶ÔÏóµÄ²¿·Ö·½·¨£¬RegExp ¶ÔÏó¶¨ÒåÁËÁ½¸öÓÃÓÚģʽƥÅäµÄ·½·¨£¬ËüÃÇÊÇexec()
ºÍtest()
ÏÂÃæÎÒÃÇÖðÒ»½øÐн²½â
¡£ºÇ£¬ºÍÉÏƪÈÕÖ¾Ò»ÑùµÄ½éÉÜ£¬¿´À´Ì×»°£¬¹ûÈ»ÊÊÓÃÓÚ¶à¸ö³¡ºÏ¡£àÅ¡£
exec() ¼ìË÷×Ö·û´®ÖеÄÖ¸¶¨Öµ£¬·µ»ØÖµÊDZ»ÕÒµ½µÄÖµ£¬Èç¹ûûÓз¢ÏÖÆ¥Å䣬Ôò·µ»Ø null£º
Ö÷ÒªµÄRegExpģʽƥÅä·½·¨Ê ......

JavaScript ÕýÔò±í´ïʽ Ñ¡Ôñ¡¢·Ö×éºÍÒýÓÃ

JavaScriptµÄÕýÔò±í´ïʽ֧³Ö²¼¶û²Ù×÷£¬³ýÁË×÷Ϊ Ñ¡ÔñµÄ“²¼¶û»ò”²Ù×÷Ö®Í⣬ÕýÔò±í´ïʽ»¹Ö§³Ö·Ö×éºÍÒýÓÃ
¡£ÆäʵѡÔñ¡¢·Ö×éºÍÒýÓõÄ×÷Ó÷ֱðΪ£ºÖ¸¶¨Ñ¡ÔñÏî¡¢¶Ô×Ó±í´ïʽ·Ö×éºÍÒýÓà ǰһ×Ó±í´ïʽµÄÌØÊâ×Ö·û¡£
ÕýÔò±í´ïʽµÄÑ¡Ôñ£º
ËùνѡÔñ¼´ÔÚ¶à¸öÌõ¼þÀïÃæÑ¡ÔñÒ»¸ö£¬±ÈÈç˵ÂôË®¹ûµÄ´óү˵ËÍÄã¸öË®¹û£¬Äã¿ÉÒÔÑ¡Ô ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ