当前位置:网站首页>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()边栏推荐
- 基于HPC场景的集群任务调度系统LSF/SGE/Slurm/PBS
- Is the soft test intermediate useful??
- The mobile terminal automatically adjusts the page content and font size by setting rem
- P1223 排队接水/1319:【例6.1】排队接水
- Slurm资源管理与作业调度系统安装配置
- I'd rather say simple problems a hundred times than do complex problems once
- 深入分析ERC-4907协议的主要内容,思考此协议对NFT市场流动性意义!
- TypeScript 接口继承
- Schnuka: machine vision positioning technology machine vision positioning principle
- [dai6] mirror image of JZ27 binary tree
猜你喜欢

中级软件评测师考什么

【推薦系統 01】Rechub

2022年7月10日“五心公益”活动通知+报名入口(二维码)

The variables or functions declared in the header file cannot be recognized after importing other people's projects and adding the header file

String formatting

打算参加安全方面工作,信息安全工程师怎么样,软考考试需要怎么准备?

2022年上半年5月网络工程师试题及答案

CSAPP Bomb Lab 解析

Using U2 net deep network to realize -- certificate photo generation program

ThreadLocal会用可不够
随机推荐
1321: [example 6.3] deletion problem (noip1994)
0x0fa23729 (vcruntime140d.dll) (in classes and objects - encapsulation.Exe) exception thrown (resolved)
Socket communication principle and Practice
IDA中常见快捷键
【推荐系统 02】DeepFM、YoutubeDNN、DSSM、MMOE
深入分析ERC-4907协议的主要内容,思考此协议对NFT市场流动性意义!
Schnuka: machine vision positioning technology machine vision positioning principle
leetcode-304:二维区域和检索 - 矩阵不可变
01 use function to approximate cosine function (15 points)
What are the contents of the intermediate soft test, the software designer test, and the test outline?
Deeply analyze the main contents of erc-4907 agreement and think about the significance of this agreement to NFT market liquidity!
CSAPP Bomb Lab 解析
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
Basic introduction of yarn and job submission process
Study summary of postgraduate entrance examination in November
How embedded engineers improve work efficiency
施努卡:机器视觉定位技术 机器视觉定位原理
BigDecimal value comparison
555 circuit details
浅谈日志中的返回格式封装格式处理,异常处理