当前位置:网站首页>JS implementation chain call
JS implementation chain call
2022-07-07 10:38:00 【xinxin_ csdn】
Four operations can be realized by chain method
/* Simple chain call Class implementation */
class Person{
constructor(){
this.name = ''
}
setName(name) {
this.name = name
return this
}
getName() {
console.log('name:==',this.name)
}
}
const person = new Person()
person.setName('zx').getName()
/* Function implementation */
function Person() {
this.name = ''
}
Person.prototype = {
setName: function(name) {
this.name = name
return this
},
getName: function() {
console.log('name:==',this.name)
}
}
const person = new Person()
person.setName('zx').getName()
边栏推荐
- 【STM32】STM32烧录程序后SWD无法识别器件的问题解决方法
- 南航 PA3.1
- Five simple and practical daily development functions of chrome are explained in detail. Unlock quickly to improve your efficiency!
- 多线程-异步编排
- 1323:【例6.5】活动选择
- @Transcation的配置,使用,原理注意事项:
- 2022年上半年5月网络工程师试题及答案
- Leetcode-304: two dimensional area and retrieval - matrix immutable
- 【作业】2022.7.6 写一个自己的cal函数
- 【实战】霸榜各大医学分割挑战赛的Transformer架构--nnFormer
猜你喜欢
Elegant controller layer code
小程序跳转H5,配置业务域名经验教程
555电路详解
Find the greatest common divisor and the least common multiple (C language)
Pre knowledge reserve of TS type gymnastics to become an excellent TS gymnastics master
openinstall与虎扑达成合作,挖掘体育文化产业数据价值
P2788 数学1(math1)- 加减算式
CAS mechanism
Some superficial understanding of word2vec
Basic introduction of yarn and job submission process
随机推荐
浅谈日志中的返回格式封装格式处理,异常处理
Yarn的基础介绍以及job的提交流程
0x0fa23729 (vcruntime140d.dll) (in classes and objects - encapsulation.Exe) exception thrown (resolved)
简单易修改的弹框组件
MONAI版本更新到 0.9 啦,看看有什么新功能
软考中级电子商务师含金量高嘛?
IIC Basics
5个chrome简单实用的日常开发功能详解,赶快解锁让你提升更多效率!
软考一般什么时候出成绩呢?在线蹬?
中级网络工程师是什么?主要是考什么,有什么用?
2022.7.3DAY595
table宽度比tbody宽度大4px
Some superficial understanding of word2vec
CAS机制
IDA中常见快捷键
Elegant controller layer code
The width of table is 4PX larger than that of tbody
openinstall与虎扑达成合作,挖掘体育文化产业数据价值
CC2530 zigbee IAR8.10.1环境搭建
软考中级,软件设计师考试那些内容,考试大纲什么的?