收集的知识点-大集合

1

URI是统一资源标识的意思,通常我们所说的URL只是URI的一种。典型URL的格式如下所示。下面提到的URL编码,实际上应该指的是URI

foo://example.com:8042/over/there?name=ferret#nose

   \_/ \______________/ \________/\_________/ \__/

    |         |              |         |        |

  scheme     authority                path      query   fragment

 

2

//数组里面的数字排序
Array.prototype.numSort=function(){
this.sort(function(a,b){
 return a-b;
});
 return this;
};
//数组里面的字符串排序按拼音
Array.prototype.strSort=function(){
this.sort(function(str1,str2){
 return str1.localeCompare(str2);
});
return this;
};
//数组去重
Array.prototype.deleteSame=function(){
var result=[]
for(var i=0;i<this.length;i++){
 if(! this.hasSection(result,this[i])){
 result.push(this[i])
 }
}
return result;
};
//判断一个数组包含不包含一个元素
Array.prototype.hasSection=function(arr,n){
   for(var i=0;i<arr.length;i++){
if(arr[i]==n){
 return true;
 }
}
return false
};

 

posted @ 2012-03-26 15:24  我的前端笔记  阅读(129)  评论(0编辑  收藏  举报