- 博客(5)
- 收藏
- 关注
原创 js实现二叉搜索树
class Node { constructor(key) { this.key = key; this.left = null; this.right = null; }}class BinarySearchTree { constructor() { this.root = null; } insert(key) { const newNode = new Node(key); if (this.root === null)
2020-12-02 16:37:25
123
原创 js实现单向链表
class Node { constructor(data) { this.data = data; this.next = null; }}class LinkedList { constructor() { this.length = 0; this.head = null; } append(data) { const newNode = new Node(data); if (this.length === 0) {
2020-12-02 16:19:31
181
原创 js实现栈结构
class Stack { //属性 constructor() { this.items = []; } //压栈 push(ele) { this.items.push(ele); } //弹栈 pop() { return this.items.pop(); } //peek peek() { return this.items[this.items.length - 1]; } //判断是否为空 isEmpty.
2020-12-02 16:09:10
104
原创 js实现继承的几种方式
1.原型链继承 function Father(name) { this.name = name || 'father'; } Father.prototype.printName = function () { console.log(this.name); }; function Son() {} Son.prototype = new Father();
2020-11-12 11:20:49
207
1
原创 Vuex 区分 State 是外部直接修改,还是通过commit修改
computed: {height() {return this.KaTeX parse error: Expected 'EOF', got '}' at position 29: …eight; }̲, flag(…store.state;}},watch: {flag: {handler() {if (this.KaTeX parse error: Expected '}', got 'EOF' at end of input: …nsole.log(t
2020-11-11 17:07:37
790
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人