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

[·­Òë]High Performance JavaScript(015)

µÚÎåÕ  Strings and Regular Expressions  ×Ö·û´®ºÍÕýÔò±í´ïʽ
    Practically all JavaScript programs are intimately tied to strings. For example, many applications use Ajax to fetch strings from a server, convert those strings into more easily usable JavaScript objects, and then generate strings of HTML from the data. A typical program deals with numerous tasks like these that require you to merge, split, rearrange, search, iterate over, and otherwise handle strings; and as web applications become more complex, progressively more of this processing is done in the browser.
    ¼¸ºõËùÓÐJavaScript³ÌÐò¶¼Óë×Ö·û´®²Ù×÷½ôÃÜÏàÁ¬¡£ÀýÈ磬Ðí¶àÓ¦ÓóÌÐòʹÓÃAjax´Ó·þÎñÆ÷»ñÈ¡×Ö·û´®£¬½«ÕâЩ×Ö·û´®×ª»»³É¸üÒ×ÓõÄJavaScript¶ÔÏó£¬È»ºó´ÓÊý¾ÝÖÐÉú³ÉHTML×Ö·û´®¡£Ò»¸öµäÐ͵ijÌÐòÐèÒª´¦ÀíÈô¸ÉÕâÑùµÄÈÎÎñ£¬ºÏ²¢£¬·Ö½â£¬ÖØÐÂÅÅÁУ¬ËÑË÷£¬±éÀú£¬ÒÔ¼°ÆäËû·½·¨´¦Àí×Ö·û´®¡£Ëæ×ÅÍøÒ³Ó¦ÓÃÔ½À´Ô½¸´ÔÓ£¬Ô½À´Ô½¶àµÄ´ËÀàÈÎÎñ½«ÔÚä¯ÀÀÆ÷ÖÐÍê³É¡£
    In JavaScript, regular expressions are essential for anything more than trivial string processing. A lot of this chapter is therefore dedicated to helping you understand how regular expression engines internally process your strings and teaching you how to write regular expressions that take advantage of this knowledge.
    ÔÚJavaScriptÖУ¬ÕýÔò±í´ïʽÊDZز»¿ÉÉٵĶ«Î÷£¬ËüµÄÖØÒªÐÔÔ¶³¬¹ýËöËéµÄ×Ö·û´®´¦Àí¡£±¾ÕÂʹÓÃÏ൱ƪ·ù°ïÖúÄúÁ˽âÕýÔò±í´ïʽÒýÇæ´¦Àí×Ö·û´®µÄÔ­Àí£¬²¢½²ÊÚÈçºÎÀûÓÃÕâЩ֪ʶÊéдÕýÔò±í´ïʽ¡£
    Also in this chapter, you'll learn about the fastest cross-browser methods for concatenating and trimming strings, discover how to increase regex performance by reducing backtracking, and pick up plenty of other tips and tricks for efficiently processing strings and regular expressions.
    ͨ¹ý±¾ÕÂÄÚÈÝ£¬Äú»¹½«Ñ§µ½¹ØÓÚÁ¬½Ó¡¢ÐÞÕû×Ö·û´®µÄ×î¿ìµÄ¿çä¯ÀÀÆ÷·½·¨£¬Ì½Ë÷ÈçºÎͨ¹ý¼õÉÙ»ØËÝÀ´Ìá¸ßÕýÔò±í´ïʽµÄÐÔÄÜ£¬²¢ÌôÑ¡ÁËһЩ¹ØÓÚ¸ßЧ´¦Àí×Ö·û´®ºÍÕýÔò±í´ïʽµÄ¼¼ÇÉ¡£
String Concatenation  ×Ö·


Ïà¹ØÎĵµ£º

javascript¿çä¯ÀÀÆ÷´´½¨XML¶ÔÏó


var
 
xmlDoc
 
=
 
null
;
function
 
parseXML
(
xmlUrl
)
{
¡¡¡¡try
 
{
¡¡¡¡¡¡¡¡//IE
¡¡¡¡¡¡¡¡xmlDoc
 
=
 
new
 
ActiveXObject
(
"Microsoft.XMLDOM"
);
¡¡¡¡¡¡¡¡xmlDoc
.
async
 
=
 
false
;
¡¡¡¡¡¡¡¡xmlDoc ......

javascript¼Ì³Ð·½Ê½Ö®¶þ

2¡¢Ô­ÐÍ·½Ê½Ð´À࣬ԭÐÍ·½Ê½¼Ì³Ð
core js×ÔÉíµÄ¶ÔÏóϵͳ¾ÍÊDzÉÓÃÔ­ÐÍ·½Ê½(prototype based)¼Ì³ÐµÄ¡£»òÕß˵core
jsûÓвÉÓó£¼ûµÄÀà¼Ì³Ð(class
based)ϵͳ£¬¶øÊÇʹÓÃÔ­Ðͼ̳ÐÀ´ÊµÏÖ×Ô¼ºµÄ¶ÔÏóϵͳ¡£¹¤×÷ÖÐÎÒÃÇÒ²¿ÉÒÔÓÃÔ­ÐÍ·½Ê½À´ÊµÏּ̳У¬´úÂ븴ÓÃÒÔ¹¹½¨×Ô¼ºµÄ¹¦ÄÜÄ£¿é¡£
/**
* ¸¸ÀàPolygon:¶à±ßÐÎ
*
*/
functio ......

JavaScript»ù´¡ÖªÊ¶2

ÍæPHP¡¢Delphi¡¢Java»ù±¾É϶¼ÓжÔÏó£¬Ï°¹ßÕâÖÖ˼·ºóÉÏÊÖÈκÎÓïÑÔ¶¼Ïë¿¿OO˼·£¬Õâ¾ø²»ÊÇÔÚ¸Ïʱ÷Ö£¬¶øÊÇ°ÑÏà¹Ø´úÂë½øÐÐÄÚ¾ÛµÄÈ·¿ÉÒÔÌå»áµ½Î¬»¤µÄ·½±ã£¡
ÔÚJavaScriptÖÐÈçºÎ´´½¨¶ÔÏó£¿
JavaScriptÊÇ»ùÓÚ¶ÔÏóµÄ£¡ËüÒ²ÊÇÒÔObjectΪ¸ùÀ࣬ÆäËüÀà¼Ì³ÐÖ®¡£ÔÚ¸ùÀàÌṩÁ˼¸¸ö·½·¨¡£¹©¼Ì³ÐÀàʹÓã¡
ÒÔÏÂÊÇ´´½¨¶ÔÏóµÄÀý×Ó£º
funct ......

JavaScript»ù´¡ÖªÊ¶3

Òþ²Ø³ÉÔ±±äÁ¿
ÔÚº¯ÊýÌåÄÚ¶¨ÒåµÄ±äÁ¿Îª¾Ö²¿±äÁ¿£¬À뿪º¯Êý¾Í¹ÒµôÁË
ÔÚº¯ÊýÌåÄÚʹÓÃthis.³ÉÔ±±äÁ¿Ãû£¬ÔòΪwindow¶ÔÏ󼶱äÁ¿£¬¼´È«¾Ö±äÁ¿
¹ÊÐèÒªÕâÑùÒþ²Ø³ÉÔ±±äÁ¿£¬ÏòÍâÖ»±©Â¶get¡¢setº¯Êý
function testClass(name){
var _firstname=name;
return {
getname : function() {
return _fir ......

[·­Òë]High Performance JavaScript(012)

µÚËÄÕ  Algorithms and Flow Control  Ëã·¨ºÍÁ÷³Ì¿ØÖÆ
    The overall structure of your code is one of the main determinants as to how fast it will execute. Having a very small amount of code doesn't necessarily mean that it will run quickly, and having a large amount of code ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ