javascript ѧϰ±Ê¼Ç£¨3£©
1. º¯ÊýÔÚÖ´ÐÐÍê return Ö¸Áîºó¾Í»áÍ£Ö¹Ö´ÐдúÂë.
function test(Num1,Num2){
return Num1+Num2;
alert(Num1+Num2); //never outputs
}
2. javascript º¯Êý²»ÄÜÖØÔØ,Ò²¾ÍÊÇ˵¿ÉÒÔÔÚͬһ¸ö×÷ÓÃÓòÖж¨Òå¶à¸öͬÃûº¯Êý,¶ø×îÖÕÖ´ÐеÄÊǺóÒ»¸öº¯Êý.
function test(num){
alert(num+10);
}
function test(num){
alert(num+100);
}
test(1); //outputs "101"
3. ÔÚº¯Êý´úÂëÖпÉÒÔʹÓÃÌØÊâ¶ÔÏó arguments È¡µÃûÓÐÃ÷È·Ö¸³öµÄ²ÎÊýÃû¾ÍÄÜ·ÃÎÊËûÃÇ.ͬʱ¿ÉÒÔʹÓà arguments.length »ñµÃ´«µÝ¸øº¯ÊýµÄ²ÎÊý¸öÊý.
function test(){
alert(arguments[0]);
}
test("hello"); //outputs "hello"
//----------------------------------
function testNum(){
alert(arguments.length);
}
testNum(12); //outputs "1"
testNum("hello",12); //outputs "2"
testNum(); //outputs "0"
4. º¯Êýʵ¼ÊÉÏÊǹ¦ÄÜÍêÕûµÄ¶ÔÏó. Function Àà.
5. º¯ÊýµÄ toString() ºÍ valueOf() ·½·¨·µ»ØµÄ¶¼ÊǺ¯ÊýµÄÔ´´úÂë.
6. javascript Ö§³Ö±Õ°ü.¼´º¯Êý¿ÉÒÔʹÓú¯ÊýÍⶨÒåµÄ±äÁ¿.
var test = "hello world";
function sayHelloWorld(){
alert(test);
}
sayHelloWorld(); //outputs "hello world";
var Num1 = 10;
function doAdd(Num2,Num3){
function doItAdd(){
return Num1+Num2+Num3;
}
return doItAdd();
}
Ïà¹ØÎĵµ£º
ÓÃÁ˺ܾÃJavaScript£¬¶Ô¡¾this¡¿µÄÈÏʶֻ¾ÖÏÞÓÚÒÔÍùµÄƾ¾Ñé¶øÒÑ£¬²»¹ý½ñÌì·¢ÏÖÁ˺ö«Î÷“http://www.quirksmode.org/js/associative.html”£¬ÏêϸÃèÊöÁËÈçºÎʹÓá¾this¡¿¹Ø¼ü×Ö£¬ÔÚÕâÀïÎҾͼò¶ÌµÄ˵һÏÂÖØµã£¬Èç¹ûÓÐÒÉÎÊ¿ÉÒÔÖ±½Ó²Î¿¼ÔÎÄ¡£
ÔÚѧϰ¹ýÓÐthisµÄ±à³ÌÓïÑÔÖУ¬thisÒ»°ã¶¼ÊÇÖ¸Ïòµ±Ç°ÊµÀý¶ÔÏóµÄ£¬¶ÔÓ ......
ÔçÉÏÔÚcsdnÉÏ¿´ÓÐÈËÎÊÒ³Ãæstyle sheetÔõôÐÞ¸ÄÀïÃæµÄrule,¾ÍдÁ˸öÀà,¸ÃÀà¶Ô¼æÈÝFFºÍIE×öÁË´¦Àí¡£
/**//*--------------------------------------------
ÃèÊö : Ìí¼ÓеÄÑùʽrule
²ÎÊý : styleSheetsË÷Òý
´úÂë :&nb ......
ת×Ô£º
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>ͼƬÅÜÂíµÆ</title>
</head>
<body>
<div style="overflow:hidden; width:350px" id='div'>
<!-- ÕâÀïÊǵÚÒ»¸ö¹Ø¼üµã£¬o ......
Êý×éÓÐËÄÖÖ¶¨ÒåµÄ·½Ê½
ʹÓù¹Ô캯Êý£º
var a = new Array();
var b = new Array(8);
var c =
new Array("first", "second", "third");
»òÕßÊý×éÖ±½ÓÁ¿£º
var d = ["first",
"second", "third"];
ÊôÐÔ
ArrayÖ»ÓÐÒ»¸öÊôÐÔ£¬¾ÍÊÇlength£¬length±íʾµ ......
// ѧϰҪÏ뿽±´ÄÇô¿ì¾ÍºÃÁË
//
// JavaScript µÄ¼Ì³ÐÊÇ»ùÓÚ prototype µÄ£¬Ã¿¸ö¶ÔÏóµÄ prototype ÊDZ£´æÔÚ¶ÔÏóµÄ __proto__ ÊôÐÔÖеģ¬Õâ¸öÊôÐÔÊÇÄÚ²¿(internal)µÄÊôÐÔ( ¹ßÀýÊÇÄÚ²¿µÄ»òÕßÒþ²ØµÄÊôÐÔÒÔ _ ¿ªÍ·)
// A prototype-based language has the notion of a prototypical object, an object used as a template ......