File talk:Javascript icon.svg

来自Wikimedia Commons
跳转到导航 跳转到搜索

This method does not follow proper javascript syntax...

According to this video http://www.youtube.com/watch?v=hQVTIJBZook at 32:20 by Doug Crockford (expert in javascript)

having the curly brace on the following line can cause problems

Your Javascript

String.protoype.trim =
 function ()
 {
   return this
       .replace (/^\s+/,"")
       .replace (/\s+$/,"");
 }


My Javascript

String.protoype.trim =
 function (){
   return this
       .replace (/^\s+/,"")
       .replace (/\s+$/,"");
 }