当前位置:网站首页>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()
边栏推荐
- [牛客网刷题 Day5] JZ77 按之字形顺序打印二叉树
- Deeply analyze the main contents of erc-4907 agreement and think about the significance of this agreement to NFT market liquidity!
- TypeScript 接口继承
- P2788 math 1 - addition and subtraction
- [daiy5] jz77 print binary tree in zigzag order
- I'd rather say simple problems a hundred times than do complex problems once
- [recommendation system 01] rechub
- PHP \ newline cannot be output
- Use the fetch statement to obtain the repetition of the last row of cursor data
- 高级软考(网络规划设计师)该如何备考?
猜你喜欢
leetcode-304:二维区域和检索 - 矩阵不可变
How much review time does it usually take to take the intermediate soft exam?
How to prepare for the advanced soft test (network planning designer)?
Openinstall and Hupu have reached a cooperation to mine the data value of sports culture industry
When do you usually get grades in the soft exam? Online pedaling?
IIC Basics
深入分析ERC-4907协议的主要内容,思考此协议对NFT市场流动性意义!
P1031 [noip2002 improvement group] average Solitaire
小程序跳转H5,配置业务域名经验教程
CAS mechanism
随机推荐
leetcode-560:和为 K 的子数组
table宽度比tbody宽度大4px
HDU-2196 树形DP学习笔记
MySQL insert data create trigger fill UUID field value
1321: [example 6.3] deletion problem (noip1994)
求方程ax^2+bx+c=0的根(C语言)
MONAI版本更新到 0.9 啦,看看有什么新功能
ArrayList线程不安全和解决方案
Some superficial understanding of word2vec
中级网络工程师是什么?主要是考什么,有什么用?
路由器开发知识汇总
Use the fetch statement to obtain the repetition of the last row of cursor data
2022年7月10日“五心公益”活动通知+报名入口(二维码)
ThreadLocal is not enough
What does intermediate software evaluator test
对word2vec的一些浅层理解
求最大公约数与最小公倍数(C语言)
Deeply analyze the main contents of erc-4907 agreement and think about the significance of this agreement to NFT market liquidity!
软考中级,软件设计师考试那些内容,考试大纲什么的?
[STM32] solution to the problem that SWD cannot recognize devices after STM32 burning program