当前位置:网站首页>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()
边栏推荐
- [牛客网刷题 Day6] JZ27 二叉树的镜像
- Some properties of leetcode139 Yang Hui triangle
- Multisim -- software related skills
- Study summary of postgraduate entrance examination in October
- IO model review
- 高级软考(网络规划设计师)该如何备考?
- BigDecimal value comparison
- CAS机制
- Study summary of postgraduate entrance examination in July
- Leetcode-303: region and retrieval - array immutable
猜你喜欢
[daiy5] jz77 print binary tree in zigzag order
【机器学习 03】拉格朗日乘子法
openinstall与虎扑达成合作,挖掘体育文化产业数据价值
Socket communication principle and Practice
Basic introduction of yarn and job submission process
基于HPC场景的集群任务调度系统LSF/SGE/Slurm/PBS
深入分析ERC-4907协议的主要内容,思考此协议对NFT市场流动性意义!
Find the greatest common divisor and the least common multiple (C language)
Use the fetch statement to obtain the repetition of the last row of cursor data
使用U2-Net深层网络实现——证件照生成程序
随机推荐
0x0fa23729 (vcruntime140d.dll) (in classes and objects - encapsulation.Exe) exception thrown (resolved)
根据设备信息进行页面跳转至移动端页面或者PC端页面
浅谈日志中的返回格式封装格式处理,异常处理
Unable to open kernel device '\.\vmcidev\vmx': operation completed successfully. Reboot after installing vmware workstation? Module "devicepoweron" failed to start. Failed to start the virtual machine
ADB utility commands (network package, log, tuning related)
2022年上半年5月网络工程师试题及答案
软考中级电子商务师含金量高嘛?
Deeply analyze the main contents of erc-4907 agreement and think about the significance of this agreement to NFT market liquidity!
高级软考(网络规划设计师)该如何备考?
成为优秀的TS体操高手 之 TS 类型体操前置知识储备
IDA中常见快捷键
What are the test preparation materials and methods for soft exam information processing technicians?
What are the contents of the intermediate soft test, the software designer test, and the test outline?
Study summary of postgraduate entrance examination in November
【作业】2022.7.6 写一个自己的cal函数
2022.7.3DAY595
路由器开发知识汇总
Network engineer test questions and answers in May of the first half of 2022
ArrayList thread insecurity and Solutions
IIC Basics