![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
练习
cunlim
这个作者很懒,什么都没留下…
展开
-
php 面向对象_练习
插入usb行为interface usb{ function cha(); function check();}class port{ protected $state = 0; protected $thing = ""; public function __construct($thing) { $this->thing = $thing; } public function cha() { $this->state = 1; } public functio原创 2020-12-16 06:09:54 · 268 阅读 · 0 评论 -
js es5严格模式_练习
在逻辑的顶端声明"use strict",启动es5.0模式arguments.callee无法在es5.0模式下使用。// "use strict"; // 执行a函数时直接报错。function a() { console.log(arguments.callee);}function b() { "use strict"; a(); // 3.0正常 console.log(arguments.callee); // 5.0报错}function c() { c原创 2020-11-02 23:06:27 · 132 阅读 · 1 评论 -
js 数组_练习
var a = [];var b = new Array();var a1 = [1,2,3]; // [1,2,3]var a2 = [1,2,,3]; // [1,2,undefined,3]var a3 = [,]; // [undefined]var a4 = [3,]; // [3]var a5 = [,3]; // [undefined,3]var b1 = new Array(1,2,3); // [1,2,3]var b2 = new Array(3);原创 2020-07-10 18:01:48 · 146 阅读 · 0 评论 -
js 深度克隆_练习
// 浅度克隆function clone(o, t) { t = t || {}; for (var k in o) { t[k] = o[k]; } return t;}// 深度克隆function deepClone(o, t) { t = t || {}; for (var k in o) { if (o.hasOwnProperty(k)) { // 排除原型链的非自定义属性 if (typeof(o[k]) == 'object') { if (Obj原创 2020-07-10 12:43:01 · 128 阅读 · 0 评论 -
js caller_练习
function a() { if (b.caller == b) { return 'fun is b'; } else { return 'other fun'; }}function b() { a(); // return 'fun is b'}function c() { a(); // return 'other fun'}b();c();原创 2020-07-10 01:38:01 · 90 阅读 · 0 评论 -
js this_练习
function a() {console.log(this);}var b = a();var c = new a();// b = {parent: Window, opener: null, …} // = window// c = a { // = a.prototype// __proto__ : {// constructor : a,// __proto__ : {...}// }// }原创 2020-07-09 23:46:27 · 118 阅读 · 0 评论 -
js 区分array和object
var arr = [];var obj = {};// type1arr.constructor == Object // "false"obj.constructor == Object // "true"// type2arr instanceof Array // "true"obj instanceof Array // "false"// type3Object.prototype.toString.call(arr); // "[object Array]"Objec原创 2020-07-08 18:47:38 · 406 阅读 · 0 评论 -
js this指向_练习
var a = { b : function () {}, // return undefined c : function () {return this}, // return a。(指向a) d : this // 指向 window}原创 2020-07-08 18:09:38 · 149 阅读 · 0 评论 -
js 命名空间_练习
// var org = {// dep1 : {// zh : {// div : '<div></div>',// changeP : function () {}// },// lianh : {// div : '<div></div>',// changeP : function () {}// }// },// dep2 : {// li : {// div : '&原创 2020-07-08 17:16:44 · 111 阅读 · 0 评论 -
js 集成模式_圣杯
Origin.prototype.oriProto = 'oriP';function Origin() { this.oriData = 'oriD';}var origin = new Origin();console.log(origin);function inherit(Ori, Tar) { F.prototype = Ori.prototype; function F() {} Tar.prototype = new F(); // 只继承Ori.prototype,不执行原创 2020-07-08 15:36:47 · 181 阅读 · 0 评论 -
js call_apply_练习
bierende.prototype.earn = function () { this.money ++;};bierende.prototype.color = 'yellow';function bierende(last) { this.last = last; this.money = 20000;}// wode.prototype = bierende.prototype;for (let k in bierende.prototype) { wode.p原创 2020-07-08 14:20:05 · 164 阅读 · 0 评论 -
js 原型链_练习
function Grand() { this.money = 20000;}Grand.prototype.last = 'zh';var grand = new Grand();function Father() { this.height = '2m';}Father.prototype = grand;var father = new Father();function Me() { this.jineng = 'IT';}Me.prototype = father;原创 2020-07-07 00:00:09 · 223 阅读 · 0 评论 -
js 构造函数_原型_练习
// a.prototype = { // 函数被定义时产生的// constructor : a,// __proto__ : {...}// }a.prototype.last = 'zh'; // 相当于添加属性// a.prototype = { // 结果// last : 'zh',// constructor : a,// __proto__ : {...}// }// a.prototype = { //相当于重新赋给属性// last : 'zh.原创 2020-07-06 23:01:53 · 238 阅读 · 0 评论