2022年4月10日

摘要: 0, NaN, undefined, false, null, '' 阅读全文
posted @ 2022-04-10 16:10 GameCat 阅读(9) 评论(0) 推荐(0) 编辑

2022年3月30日

摘要: clear:both 这种方式有两种做法 做法1 <!DOCTYPE html> <html> <head> <title>one</title> <style> .to-float { width: 100px; height: 100px; float: left; /* 不重要的部分 */ b 阅读全文
posted @ 2022-03-30 19:33 GameCat 阅读(60) 评论(0) 推荐(0) 编辑
摘要: let arr1 = [1, 2, 3, 4] function changePos(arr, a, b) { [arr[b], arr[a]] = [arr[a], arr[b]] } changePos(arr1, 0, 1) console.log(arr1) 阅读全文
posted @ 2022-03-30 15:56 GameCat 阅读(493) 评论(0) 推荐(0) 编辑
摘要: 例如 输入 quick brown fox jumps over the lazy dog. 输出: Quick Brown Fox Jumps Over The Lazy Dog. 备注:仅供参考 var str = 'quick brown fox jumps over the lazy dog 阅读全文
posted @ 2022-03-30 15:41 GameCat 阅读(57) 评论(0) 推荐(0) 编辑
摘要: 比如一个字符是 hello 反转后变成了 olleh var str = 'hello' function strReverse(str) { return str.split('').reverse().join('') } console.log(strReverse(str))// olleh 阅读全文
posted @ 2022-03-30 13:24 GameCat 阅读(40) 评论(0) 推荐(0) 编辑
摘要: 比如反转一个数组arr1中的元素的顺序得到arr2, 而arr1的元素不受影响 var arr1 = [1, 2, 3] function myReverse(arr) { return [...arr].reverse() } console.log(myReverse(arr1), arr1) 阅读全文
posted @ 2022-03-30 13:02 GameCat 阅读(756) 评论(0) 推荐(0) 编辑
摘要: 这里的完全相同指的是这种情况: var arr1 = [1, 2, 3] var arr2 = [1, 3, 2] 或者 var arr1 = [1, 2, 3] var arr2 = [1, 2, 3] 方法如下: var arr1 = [1, 2, 3] var arr2 = [1, 3, 2] 阅读全文
posted @ 2022-03-30 12:54 GameCat 阅读(905) 评论(0) 推荐(0) 编辑

2022年3月29日

摘要: function toLeft([first, ...rest]) { return [...rest, first]; } function toRight(arr) { return [arr.pop(), ...arr]; } const arr = [1, 2, 3, 4, 5]; cons 阅读全文
posted @ 2022-03-29 11:22 GameCat 阅读(607) 评论(0) 推荐(0) 编辑
摘要: let arr = [3, 4, 5, 2, 1]; let sum = arr.reduce((pre, next) => { pre += next; return pre; }, 0) console.log('结果:', sum); 阅读全文
posted @ 2022-03-29 11:10 GameCat 阅读(205) 评论(0) 推荐(0) 编辑
摘要: const isPureArray = array => { return [...new Set(array)].length array.length } console.info(isPureArray([1, 2, 3, 4])) // true console.info(isPureArr 阅读全文
posted @ 2022-03-29 10:56 GameCat 阅读(42) 评论(0) 推荐(0) 编辑

导航