码迷,mamicode.com
首页 >  
搜索关键字:prototype    ( 5322个结果
手把手带你快速入门jQuery(视频|资料,建议收藏!)
jQuery是什么? jQuery是一个快速、简洁的JavaScript框架,是继Prototype之后又一个优秀的JavaScript代码库(或JavaScript框架)。 jQuery设计的宗旨是“write Less,Do More”,即倡导写更少的代码,做更多的事情。它封装JavaScrip ...
分类:Web程序   时间:2021-06-08 23:29:27    阅读次数:0
js封装一个集合
// 基于对象封装一个集合 function Set() { // 属性 this.items = {}; // 方法 // add 往集合中添加元素 Set.prototype.add = function (value) { // 先判断是否有这个元素 if (this.has(value)) ...
分类:Web程序   时间:2021-06-02 20:02:42    阅读次数:0
设计模式 javascipt - singleton 单例模式实现
//1. ES5 闭包实现单例模式 let singleton = (function(){ let instance = null; return function(name){ this.name = name; instance = instance? instance : this; ret ...
分类:编程语言   时间:2021-06-02 14:36:57    阅读次数:0
JS 手写之 Array.prototype.filter
Array.prototype.filter filter() 方法创建一个新数组, 其包含通过所提供函数实现的测试的所有元素。 语法 var newArray = arr.filter(callback(element[, index[, array]])[, thisArg]) 参数 callb ...
分类:Web程序   时间:2021-05-25 18:03:20    阅读次数:0
继承的编码实现
// 父类 function Parent() {this.eyes = 'blue'} Parent.prototype.getEyes = function getEyes() { console.log(this.eyes) } // 子类 function Chilren() {} // 原 ...
分类:其他好文   时间:2021-05-24 08:11:12    阅读次数:0
原型(prototype)
原型(prototype) 在JavaScript中,每个函数都有一个prototype属性,这个属性指向函数的原型对象。 JavaScript不区分类和实例的概念,而是通过原型(prototype)来实现面向对象编程。 var student = { name:'lisi', age:18, ru ...
分类:其他好文   时间:2021-05-24 06:25:10    阅读次数:0
【JavaScript】Promise.then() 第二个参数和 catch() 的区别
Promise.then() 第二个参数和 catch() 的区别 首页我们先要区分几个概念 reject 是用来抛出异常的,catch 是用来处理异常的; reject 是 Promise 的方法,而 then 和 catch 是 Promise 实例的方法(Promise.prototype.t ...
分类:编程语言   时间:2021-05-24 05:39:13    阅读次数:0
Array.prototype.shift()、Array.prototype.unshift()方法
1. Array.prototype.shift()方法 (1)定义:用于删除数组的第一个元素,并返回该元素。注意,该方法会改变原数组 1 var a = ['a', 'b', 'c']; 2 3 a.shift() // 'a' 4 a // ['b', 'c'] 上面代码中,使用shift()方 ...
分类:其他好文   时间:2021-05-24 04:13:41    阅读次数:0
Array.prototype.push()方法
1. 定义:用于在数组的末端添加一个或多个元素,并返回添加新元素后的数组长度。注意,该方法会改变原数组 2. 代码使用push方法,往数组中添加了四个成员 1 var arr = []; 2 console.log(arr.push(1)); //1 3 console.log(arr.push(' ...
分类:其他好文   时间:2021-05-24 01:39:52    阅读次数:0
js时间转换
参考博客: https://www.cnblogs.com/tugenhua0707/p/3776808.html 代码: Date.prototype.format = function(fmt) { var o = { "M+" : this.getMonth()+1, //月份 "d+" : ...
分类:Web程序   时间:2021-05-24 00:40:16    阅读次数:0
5322条   上一页 1 2 3 4 ... 533 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!