伊人怎会持宠而骄
希望有人懂你的低头不语、小心翼翼守护你的孩子气

随笔分类 -  重点总结

数组排序
摘要:方法一:从数组中首元素开始和其他元素逐个比较,若其中一个元素比其小(或大),就交换首元素与其位置 int k[] = {3,4,5,1,0,2}; for(int i=0;i<k.length-1;i++) { for(int j=i+1;j<k.length;j++) { if(k[i]>k[j] 阅读全文
posted @ 2019-07-31 17:35 伊人怎会持宠而骄 阅读(119) 评论(0) 推荐(0)
数组去重的方法
摘要:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> </body> </html> <script> /* 2、 编写函数has(arr , num) 判断数组中是否存在num这个元素 阅读全文
posted @ 2019-01-25 13:43 伊人怎会持宠而骄 阅读(135) 评论(0) 推荐(0)
判断方法
摘要:判断非数字 isNAN() 括号中为非数字 isNAN() 括号中为非数字 测试变量的类型 typeof() typeof typeof() 结果都是string typeof() typeof typeof() 结果都是string 阅读全文
posted @ 2019-01-21 10:40 伊人怎会持宠而骄 阅读(102) 评论(0) 推荐(0)
循环遍历
摘要:item 表示数组中的数据 index 表示下标 array 表示遍历的数组 item 表示数组中的数据 index 表示下标 array 表示遍历的数组 while do...while for for(var i = 1 ; i <= 100 ; i++){ break } for(var i 阅读全文
posted @ 2019-01-21 10:40 伊人怎会持宠而骄 阅读(149) 评论(0) 推荐(0)
转换方法
摘要:关联数组转对象 json_encode() var arr=( array("sname"=>"jack") ) json_encode( arr ) json_encode() var arr=( array("sname"=>"jack") ) json_encode( arr ) 对象转字符串 阅读全文
posted @ 2019-01-21 10:37 伊人怎会持宠而骄 阅读(133) 评论(0) 推荐(0)
数组去重
摘要:方法一 set 数组去重 定义一个函数 实现数组去重 返回去重后的数组 function norepeat( arr ){ var set = new Set( arr ); return Array.from( set );(返回去重后的数组) return Array.from( new Set 阅读全文
posted @ 2019-01-21 10:36 伊人怎会持宠而骄 阅读(176) 评论(0) 推荐(0)
js常见兼容
摘要:滚动条的兼容写法(谷歌chrome) document.documentElement.scrollTop || document.body.scrollTop document.documentElement.scrollTop || document.body.scrollTop 阻止浏览器默认 阅读全文
posted @ 2019-01-21 10:34 伊人怎会持宠而骄 阅读(102) 评论(0) 推荐(0)