自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 a 标签跨域下载视频

【代码】a 标签跨域下载视频。

2024-03-27 23:27:22 252

原创 i18n 在js 文件里切换不改变探索

2> 参考react 不可变性, 传入一个新对象,即可触发更新。1> 重新渲染组件,绑定key;1. 将对象属性改写为getter。

2023-12-31 20:56:09 443 1

原创 js 冒泡排序

function bubbleSort (arr) { let len = arr.length for (let i = 0; i < len - 1; i++) { for (let j = 0; j < len - 1 - i; j++) { // 如果前一个比后一个大 互换位置 if (arr[j] > arr[j + 1]) { [arr[j + 1], arr[j].

2022-03-19 03:14:22 153

原创 双端队列数据结构

class Deque { constructor() { this.count = 0; this.lowestCount = 0; this.items = {}; } addFront(element) { if (this.isEmpty()) { this.addBack(element); } else if (this.lowestCount > 0) { this.lowestCount--; ..

2021-09-20 16:41:39 83

原创 JS queue

class Queue { constructor() { this.count = 0; this.lowestCount = 0; this.items = {}; } enqueue(element) { this.items[this.count] = element; this.count++; } dequeue() { if (this.isEmpty()) { return undefined; }.

2021-09-20 16:37:11 85

原创 js Array 模仿栈

export default class StackArray { constructor() { this.items = []; } push(element) { this.items.push(element); } pop() { return this.items.pop(); } peek() { return this.items[this.items.length - 1]; } isEmpty() { .

2021-09-20 16:26:25 122

转载 阅读完,中级以上前端码农不成问题

https://hejialianghe.gitee.io/jsadvanced/function.html#_2-1-1-js%E5%86%85%E5%AD%98%E6%9C%BA%E5%88%B6

2021-08-24 00:18:15 86

原创 什么是amd、commonjs、umd、esm?

amd(Asynchronous Module Definitions)异步加载 其被提出,主要用于客户端browser 其语法不直观,没有commonjs便于书写 运行时加载commonjs (同步加载) // 文件名: foo.js // 依赖 var $ = require('jquery'); // 方法 function myFunc(){}; // 暴露公共方法(一个) module.exports = myFunc;.

2021-08-17 22:13:07 448

转载 js 深拷贝

js 数据类型俩大类:基本数据类型 =>存在栈里,直接赋值,直接用引用数据类型 => 存在堆里,一般赋值是指针,通过指针访问堆里的内容当引用数据类型相互赋值的时候,复制的是指针,同一个指针是指向同一个内存地址所以就有了深拷贝,浅拷贝的问题; 深拷贝指的是引用数据类型1, 简单粗暴let obj = {}JSON.parse(JSON.stringify(obj ))缺点:https://blog.csdn.net/weixin_46100406/article/de.

2021-07-19 22:10:00 42

原创 前端性能优化方向

1. 通过异步重要资源的下载来减小请求数量,(减少请求数量)2. 优化必须的请求数量和每个请求的文件体积,(减少包体积)3. 通过区分关键资源的优先级来优化被加载关键资源的顺序,来缩短关键路径长度。(控制优先级加载必要文件)...

2021-06-26 17:22:40 60

原创 web新能优化

1. 什么是web性能?Web 性能指页面加载到可交互和可响应所消耗的时间,以及页面在交互时的流畅度;Web 性能是客观的衡量标准,是用户对加载时间和运行时的直观体验。 ...

2021-06-26 15:43:13 87

原创 Function.prototype.bind

// Does not work with `new (funcA.bind(thisArg, args))`Function.prototype.bind = function (context, ...args) { if (typeof this !== 'function') { // closest thing possible to the ECMAScript 5 // internal IsCallable function thr.

2021-06-04 09:28:16 91

原创 Function.prototype.apply

Function.prototype.apply = function (context, args) { if (typeof this !== 'function') { throw new TypeError('Type Error') } const fn = Symbol('fn') context[fn] = this let result = context[fn](...args) delete context[fn] .

2021-06-04 09:07:18 76

原创 Function.prototype.call

Function.prototype.call = function (context, ...args) { if (typeof this !== 'function') { throw new TypeError('Type Error'); } const fn = Symbol('fn') context[fn] = this let result = context[fn](...args) delete context[fn].

2021-06-04 09:06:41 76

原创 js 实现链表结构

// 链表节点class Node { constructor(node) { this.node = node this.next = null }}// 链表类class LinkedList { constructor(head = null) { this.head = head this.length = 0 } getNodeAt(index) { // 边界情况.

2021-06-02 10:53:07 56

原创 2021-05-17

class PubSub { list = {} add(type, fn) { let fns = this.list[type] ? this.list[type] : this.list[type] = [] // 防止重名的回调 !fns.includes(fn) && fns.push(fn) return this } off(type, fn) { let fns.

2021-05-17 16:39:57 48

原创 2021-04-29

js鸭式辩形(duck typing)通俗说法是:“如果它走起路来像鸭子,叫起来也是鸭子,那么它就是鸭子。实现: 参考博客

2021-04-29 09:29:03 45

原创 2021-04-26

编写一个webpack-loaderloader 是导出为一个函数的 node 模块。该函数在 loader 转换资源的时候调用。给定的函数将调用loader API,并通过this上下文访问e.g. :loader-txt.js:import { getOptions } from 'loader-utils'export default function loader (source, map, meta) { const options = getOptions(thi...

2021-04-26 15:00:41 65

原创 2021-04-15

最新的 ECMAScript 标准定义了 9种数据类型:6 种原始类型,使用typeof运算符检查: undefined:typeof instance === "undefined" Boolean:typeof instance === "boolean" Number:typeof instance === "number" String:typeof instance === "string BigInt:typeof instance === "bigint" S...

2021-04-15 16:12:31 53

原创 webpack 打包速度优化之dll hard-source-webpack-plugin

从vue-cli和create-react-app中可以知道并没有实用dll,Webpack 4 的打包性能足够好的,dll已经放弃。直接上代码:const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');module.exports = { // ...... plugins: [ new HardSourceWebpackPlugin() // <- 直接加入这行代码就行 ]...

2020-07-20 21:05:09 598 1

原创 当fixed 遇见transform

今天有个同事请教问题: fixed布局失效,他给我说是根据父级定位, 开发将近5年的我郁闷不已, 主要是他还拿出了实例,后经作者一番搜索之后, 发现fixed遇见 父级有transform的会失效。。。。参考:张鑫旭 大神效果如图:...

2020-05-26 23:03:14 241

原创 js 异步原理

同步JavaScript要理解什么是异步JavaScript ,我们应该从确切理解同步JavaScript 开始。先看一个简单的例子(运行它, and这是源码):const btn = document.querySelector('button');btn.addEventListener('click', () => { alert('You clicked me!'); let pElem = document.createElement('p'); pElem...

2020-05-19 23:37:00 233

原创 vuep 踩坑

https://github.com/wanglanglang0318/vuep.git

2020-05-16 00:31:12 580

空空如也

空空如也

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

TA关注的人

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