ÕùÔõ·ÓÉÍø/ÍøÕ¾½Ì³Ì/ÄÚÈÝ

JavaScriptѧϰ֮ʲôÊÇ×Ö·û´®£¿js×Ö·û´®Ïà¹Ø֪ʶ½éÉÜ

ÍøÕ¾½Ì³Ì2024-05-21 ÔĶÁ
ÍøÒ³µÄ±¾ÖʾÍÊdz¬¼¶Îı¾±ê¼ÇÓïÑÔ£¬Í¨¹ý½áºÏʹÓÃÆäËûµÄWeb¼¼Êõ£¨È磺½Å±¾ÓïÑÔ¡¢¹«¹²Íø¹Ø½Ó¿Ú¡¢×é¼þµÈ£©£¬¿ÉÒÔ´´Ôì³ö¹¦ÄÜÇ¿´óµÄÍøÒ³¡£Òò¶ø£¬³¬¼¶Îı¾±ê¼ÇÓïÑÔÊÇÍòάÍø£¨Web£©±à³ÌµÄ»ù´¡£¬Ò²¾ÍÊÇ˵ÍòάÍøÊǽ¨Á¢ÔÚ³¬Îı¾»ù´¡Ö®Éϵġ£³¬¼¶Îı¾±ê¼ÇÓïÑÔÖ®ËùÒÔ³ÆΪ³¬Îı¾±ê¼ÇÓïÑÔ£¬ÊÇÒòΪÎı¾Öаüº¬ÁËËùν¡°³¬¼¶Á´½Ó¡±µã¡£
±¾ÆªÎÄÕ¾͸ø´ó¼Ò´øÀ´JavaScriptѧϰ֮ʲôÊÇ×Ö·û´®£¿js×Ö·û´®Ïà¹Ø֪ʶ½éÉÜ¡£ÓÐÒ»¶¨µÄ²Î¿¼¼ÛÖµ£¬ÓÐÐèÒªµÄÅóÓÑ¿ÉÒԲο¼Ò»Ï£¬Ï£Íû¶ÔÄãÃÇÓÐËù°ïÖú¡£

JavaScript ×Ö·û´®

JavaScript×Ö·û´®ÓÃÓÚ´æ´¢ºÍ´¦ÀíÎı¾¡£

×Ö·û´®¿ÉÒԴ洢һϵÁÐ×Ö·û£¬Èç"HAHA"£»

×Ö·û´®ÊÇ¿ÉÒÔ²åÈëµ½ÒýºÅÖеÄÈκÎ×Ö·û£¬¿ÉÒÔʹÓõ¥ÒýºÅ£¬Ò²¿ÉÒÔʹÓÃË«ÒýºÅ¡£

ÀýÈ磺

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>Insert title here</title>
	</head>
	<body>
    <span id="demo"></span>
    <button onclick='this.innerHTML=Date()'>ʱ¼ä</button>
	</body>
	<script type="text/javascript">
    var stringa = "¹þ¹þ";    var stringb = 'ÄãºÃ£¬Ä㻵£¬ÄãºÃ»µ£¡£¡';
	</script>
</html>

¿ÉÒÔʹÓÃË÷ÒýλÖÃÀ´·ÃÎÊ×Ö·û´®ÖеÄÿ¸ö×Ö·û£»

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
    <span id="demo"></span>
    <button onclick='this.innerHTML=Date()'>ʱ¼ä</button>
</body>
<script type="text/javascript">
    var stringa = "¹þ¹þ";    
    var stringb = 'ÄãºÃ£¬Ä㻵£¬ÄãºÃ»µ£¡£¡';    //ͨ¹ýË÷Òý·ÃÎÊ×Ö·û´®ÖеÄÿ¸ö×Ö·û    
    alert(stringb[3]);
</script>
</html>

×Ö·û´®ÖеÄË÷ÒýÊÇ´Ó0¿ªÊ¼µÄ£¬Ò²¾ÍÊÇ˵µÚÒ»¸ö×Ö·ûµÄË÷ÒýÖµÊÇ[0],µÚ¶þ¸öÊÇ[1],ÒÔ´ËÀàÍÆ¡£

¿ÉÒÔÔÚ×Ö·û´®ÖÐʹÓÃÒýºÅ£¬×Ö·û´®ÖеÄÒýºÅ²»ÒªÓëÒý×Å×Ö·û´®µÄÒýºÅÏàͬ¡£

ÀýÈ磺

 <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
    <span id="demo"></span>
    <button onclick='this.innerHTML=Date()'>ʱ¼ä</button>
</body>
<script type="text/javascript">
    var stringa = "¹þ'dd'¹þ";
    var stringb = 'ÄãºÃ£¬"Ä㻵"£¬ÄãºÃ»µ£¡£¡';
    //ͨ¹ýË÷Òý·ÃÎÊ×Ö·û´®ÖеÄÿ¸ö×Ö·û
    alert(stringb[3]);
</script>
</html>

Ò²¿ÉÒÔÔÚ×Ö·û´®ÖÐÌí¼ÓתÒå×Ö·ûÀ´Ê¹Óà ÒýºÅ \ ¾ÍÊÇתÒå×Ö·û

ÀýÈ磺

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
    <span id="demo"></span>
    <button onclick='this.innerHTML=Date()'>ʱ¼ä</button>
</body>
<script type="text/javascript">
    var stringa = "¹þ\'dd\'¹þ";
    var stringb = 'ÄãºÃ£¬\"Ä㻵\"£¬ÄãºÃ»µ£¡£¡';
    //ͨ¹ýË÷Òý·ÃÎÊ×Ö·û´®ÖеÄÿ¸ö×Ö·û
    alert(stringb[3]);
</script>
</html>

×Ö·û´®³¤¶È

¿ÉÒÔʹÓÃÄÚÖÃÊôÐÔ length À´¼ÆËã×Ö·û´®µÄ³¤¶È£º

ÀýÈ磺

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
    <span id="demo"></span>
    <button onclick='this.innerHTML=Date()'>ʱ¼ä</button>
</body>
<script type="text/javascript">
    var stringa = "¹þ\'dd\'¹þ";
    var stringb = 'ÄãºÃ£¬\"Ä㻵\"£¬ÄãºÃ»µ£¡£¡';
    //ͨ¹ýË÷Òý·ÃÎÊ×Ö·û´®ÖеÄÿ¸ö×Ö·û
    alert(stringb.length);//²é¿´×Ö·û´®stringbµÄ³¤¶È
</script>
</html>

ÌØÊâ×Ö·û

ÔÚJavaScriptÖÐ×Ö·ûÖÐдÔÚµ¥ÒýºÅ»òÕßË«ÒýºÅÖС£

Òª²»È»ÀàËÆÓÚÕâÑùµÄ×Ö·û´®ÊÇÎÞ·¨½âÎöµÄ ¡ú_¡ú "ÍÛ¹þ¹þ¹þ"À²À²"ôôßÕ"£»

ÄÅÔõô½â¾öÄØ£¿£¿£¿Ê¹ÓÃתÒå×Ö·û¾ÍºÃÁË£¬¡ú_¡ú "ÍÛ¹þ¹þ¹þ\"À²À²\"ôôßÕ"£»

\ ¾ÍÊÇתÒå×Ö·û£¬¾ÍÊǽ«ÌØÊâµÄ×Ö·ûת»»Îª×Ö·û´®×Ö·û¡£Ïêϸ¼ûϱí

JavaScriptѧϰ֮ʲôÊÇ×Ö·û´®£¿js×Ö·û´®Ïà¹Ø֪ʶ½éÉÜ

×Ö·û´®¿ÉÒÔÊǶÔÏó

ͨ³£JavaScript×Ö·û´®ÊÇԭʼֵ£¬¿ÉÒÔʹÓÃ×Ö·û´´½¨£ºvar aa= "AA";

µ«ÊÇÒ²¿ÉÒÔʹÓÃnew¹Ø¼ü×Ö½«×Ö·û´®¶¨ÒåΪһ¸ö¶ÔÏó£ºvar stringaa = new String("°²È»");

Ò»°ã²»½¨Òé´´½¨String¶ÔÏ󣬻áÓ°ÏìÖ´ÐÐËٶȣ¬²¢¿ÉÄܲúÉúÆäËûÓ°Ïì¡£

ÀýÈ磺

var aa = "AA";
var bb = new String("AA");
alert(aa === bb); //·µ»ØÖµÊÇfalse    ÒòΪ  aaÊÇ×Ö·û´®   bb ÊǶÔÏó

×Ö·û´®ÊôÐԺͷ½·¨

ԭʼֵ×Ö·û´®Ã»ÓÐÊôÐԺͷ½·¨£¬ÒòΪËûÃDz»ÊǶÔÏó¡£

ԭʼֵ×Ö·û´®¿ÉÒÔʹÓÃJavaScriptµÄÊôÐԺͷ½·¨£¬ÒòΪJavaScriptÔÚÖ´Ðз½·¨ºÍÊôÐÔʱ¿ÉÒÔ°Ñԭʼֵµ±×ö¶ÔÏó¡£

×Ö·û´®ÊôÐÔ

JavaScriptѧϰ֮ʲôÊÇ×Ö·û´®£¿js×Ö·û´®Ïà¹Ø֪ʶ½éÉÜ

×Ö·û´®·½·¨

JavaScriptѧϰ֮ʲôÊÇ×Ö·û´®£¿js×Ö·û´®Ïà¹Ø֪ʶ½éÉÜ

×ܽ᣺ÒÔÉϾÍÊDZ¾ÆªÎĵÄÈ«²¿ÄÚÈÝ£¬Ï£ÍûÄܶԴó¼ÒµÄѧϰÓÐËù°ïÖú¡£¸ü¶àÏà¹Ø½Ì³ÌÇë·ÃÎÊJavaScriptÊÓƵ½Ì³Ì£¬jQueryÊÓƵ½Ì³Ì£¬bootstrap½Ì³Ì£¡

ÒÔÉϾÍÊÇJavaScriptѧϰ֮ʲôÊÇ×Ö·û´®£¿js×Ö·û´®Ïà¹Ø֪ʶ½éÉܵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢phpÖÐÎÄÍøÆäËüÏà¹ØÎÄÕ£¡


ÍøÕ¾½¨ÉèÊÇÒ»¸ö¹ãÒåµÄÊõÓº­¸ÇÁËÐí¶à²»Í¬µÄ¼¼ÄܺÍѧ¿ÆÖÐËùʹÓõÄÉú²úºÍά»¤µÄÍøÕ¾¡£



……