自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 收藏
  • 关注

原创 js sumary1

//判断浏览器类型和版本 var brower = (function () { var s = navigator.userAgent.toLowerCase() var match = /(webkit)[\/]([\w.]+)/.exec(s) || /(opera)(?:.*version)?[\/]([\w.]+)/.exec(s) || /(msie)([\w.]+)/.exec(s) || /compatible/.te...

2022-05-19 18:30:58 123

翻译 promise

const PENDING = "pending";const FULFILLED = "fulfilled";const REJECTED = "rejected";function MyPromise(fn) { const self = this; self.value = null; self.error = null; self.status = PENDING; self.onFulfilledCallbacks = []; self.o.

2022-05-11 12:21:33 98

原创 js summary

去重const uniqueElements = arr => [...new Set(arr)]var newArr = arr.reduce(function (prev, cur) { prev.indexOf(cur) === -1 && prev.push(cur); return prev;},[]);防抖动:防止抖动,每次都以最新的这一次为准;搜索输入框提示const debounce = (fn, ms = 0) => { .

2022-05-11 02:07:12 236

翻译 js字符串中出现次数最多的字母统计

var str = "cdsccabbsdfgec"function execMore (str) { var arr = str.split("").reverse() var obj = arr.reduce((prev, next) => { prev[next] = (prev[next] || 0) + 1 return prev }, {}) // 方法1、 // var tempArr = (Object.e.

2022-03-19 21:23:11 1639

转载 js 二叉树

⽤递归的遍历⽅式没啥好说的,说下⽤while循环+stack实现的遍历吧let bt = { val: 1, left: { val: 2, left: { val: 4, left: null, right: null, }, right: { val: 5, left: null,

2022-03-19 05:04:19 153

原创 js面试题

// 实现(a == 1 && a == 2 && a == 3)为true 1、var test2 = { i: 1, toString: function () { // valueOf也行 return test2.i++ } }2、 var val = 0 Object.defineProperty(window, 'test2', { get: function () { return ...

2022-03-12 14:51:04 201

原创 数组拍平方法集

const flat = (arr) => { return [].concat(...arr.map(item => item instanceof Array ? flat(item) : item)) }// toString && split 和 join() && split两种方法也行const flat = arr => [].concat(...arr.map(item => item.__proto__.constr..

2022-03-11 18:56:53 250

原创 cookie方法

// 解析cookieconst parseCookie = str => str .split(';') .map(v => v.split('=')) .reduce((acc, v) => { return (acc[decodeURIComponent(v[0].trim())] = decodeURIComponent(v[1].trim()), acc)//逗号运算符 }, {});var cookes = parseCookie('foo=b.

2022-03-11 18:44:05 233

原创 base64解码与编码

// 编码之前转义(escape)字符串const b64EncodeUnicode = str => { return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => { return String.fromCharCode('0x' + p1); // '003D' -> @ }));};// base64转换回字符串const b64DecodeUnicode =.

2022-03-11 17:45:53 107

原创 js日期格式化,深拷贝,滚动回顶部

const dateFormat = (timestamp, fmt = 'yyyy-MM-dd') => { let date = new Date(timestamp); const o = { 'M+': date.getMonth() + 1, // 月份 'd+': date.getDate(), // 日 'h+': date.getHours(), // 小时 'm+': date.getMinutes(), // 分 's+': da.

2022-03-11 16:48:37 89

原创 js树形数据处理

直接处理后端返回的数据: class Itree { constructor(options) { const { list, id = 'id', pid = 'pid', nopid = null, sort = false } = options; // inner data this._list = list; this._datas = this._clone(this

2022-03-10 17:13:47 3579

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除