阿里面试题string的扩展
来源:互联网 发布:威少体测数据 编辑:程序博客网 时间:2024/06/06 17:37
var greeting = 'My name is ${name}, age ${age}, I am a ${job.jobName}';var employee = { name: "XiaoMing", age: 11, job: { jobName: "designer", jobLevel: "senior" }};
var result = greeting.render(employee);console.log(result); //??? 要求输出该格式: My name is XiaoMing, age 11, I am a designer/****************************************/
var greeting = 'My name is ${name}, age ${age}, I am a ${job.jobName}';var employee = { name: "XiaoMing", age: 11, job: { jobName: "designer", jobLevel: "senior" }};String.prototype.render = function (obj) { let _this = this; Object.assign(window,obj); _this = "\`" + _this + "\`"; _this = eval(_this); return _this;}var result = greeting.render(employee);console.log(result); // My name is XiaoMing, age 11, I am a designer
0 0
- 阿里面试题string的扩展
- 阿里的面试题
- 一道阿里的面试题
- 一道阿里的面试题
- 阿里的一些面试题
- String 的面试题
- String的面试题
- String类型的面试题
- String相关的面试题
- String类型的面试题
- String类型的面试题
- 关于String的面试题
- 一个阿里云的面试题
- 阿里面试题解答
- 阿里面试题
- 阿里面试题备份
- 阿里dba面试题
- 阿里面试题
- React Native使用fetch实现图片上传
- [Matlab]数字图像处理实验和Matlab的使用
- TP3.2.3从入门到放弃-TP框架的使用
- 数据结果实验2.1——顺序表
- Mybatis获取插入记录的自增长ID
- 阿里面试题string的扩展
- 剑指offer-51.构建乘积数组
- [编程之美-09]字符串的旋转问题
- 基于matlab的图像分块方法
- 计算机基础-数据处理能力的限制因素及流量测量
- 传递VB数组给DLL中的函数
- Elasticsearch(六)【NEST高级客户端--连接】
- CSS3变换与动画
- SSM整合