当前位置:网站首页>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()
边栏推荐
- OpenGL glLightfv 函数的应用以及光源的相关知识
- 移动端通过设置rem使页面内容及字体大小自动调整
- 使用Tansformer分割三维腹部多器官--UNETR实战
- JS实现链式调用
- Is the gold content of intermediate e-commerce division in the soft exam high?
- [牛客网刷题 Day6] JZ27 二叉树的镜像
- Mendeley--免费的文献管理工具,给论文自动插入参考文献
- Using U2 net deep network to realize -- certificate photo generation program
- 关于easyflash v3.3使用过程的记录
- Some properties of leetcode139 Yang Hui triangle
猜你喜欢
Summary of router development knowledge
5个chrome简单实用的日常开发功能详解,赶快解锁让你提升更多效率!
OpenGL glLightfv 函数的应用以及光源的相关知识
Trajectory planning for multi robot systems: methods and Applications Overview reading notes
When do you usually get grades in the soft exam? Online pedaling?
[牛客网刷题 Day5] JZ77 按之字形顺序打印二叉树
IIC Basics
SQL Server 知识汇集9 : 修改数据
软考中级有用吗??
使用 load_decathlon_datalist (MONAI)快速加载JSON数据
随机推荐
1323:【例6.5】活动选择
Schnuka: working principle of robot visual grasping machine visual grasping
P2788 数学1(math1)- 加减算式
CC2530 zigbee IAR8.10.1环境搭建
【STM32】STM32烧录程序后SWD无法识别器件的问题解决方法
A small problem of bit field and symbol expansion
Sword finger offer 38 Arrangement of strings [no description written]
ADB utility commands (network package, log, tuning related)
Deeply analyze the main contents of erc-4907 agreement and think about the significance of this agreement to NFT market liquidity!
HDU-2196 树形DP学习笔记
Gym installation pit records
【PyTorch 07】 动手学深度学习——chapter_preliminaries/ndarray 习题动手版
JS实现链式调用
The width of table is 4PX larger than that of tbody
【作业】2022.7.6 写一个自己的cal函数
P1223 排队接水/1319:【例6.1】排队接水
Common shortcut keys in IDA
使用U2-Net深层网络实现——证件照生成程序
浅谈日志中的返回格式封装格式处理,异常处理
ArrayList线程不安全和解决方案