繁体   English   中英

“Twilio Quest”挑战,任何帮助将不胜感激,我不知道我做错了什么,

[英]"Twilio Quest" challenge, any help would be appreciated, I dont know what I'm doing wrong,

似乎无法掌握这个“Twilio Quest”挑战。

嘿,过去一周我一直在玩这款名为“Twilio Quest”的游戏。
我只是想学习 JavaScript,我觉得它看起来有点整洁。
所服务的挑战的难度上下波动。 但我一直设法绕过,直到现在。
Been reading through: JavaScript.info - Classes , MDN - Classes , JavaScript.info - Object literal notation and MDN - Object Initialization I tried alot of aproaches. 但我似乎真的无法接受这个挑战。
任何帮助将非常感激。 我只是想学习。 提前致谢。
这是我想要做的事情:

class TargetingSolution {
  constructor(config) {
    // your code here
  }

  // your code here
}

// The following lines of code are not required for the solution, but can be
// used by you to test your solution.
const m = new TargetingSolution({
  x: 10,
  y: 15,
  z: 900
});

console.log(m.target()); // would print "(10, 15, 900)"
class TargetingSolution{
    x = 0;
    y = 0;
    z = 0;
    constructor(config){
        this.x = config.x;
        this.y = config.y;
        this.z = config.z;
    }
    target(){
        return '('+this.x+', '+this.y+', '+this.z+')';
    }
}
class TargetingSolution {
constructor (object) {
this.xcoord= String(object.x)
this.ycoord = String(object.y)
this.zcoord = String(object.z)
}
target() {
return ('('+this.xcoord+', '+this.ycoord+', '+this.zcoord+')')
}}
const sln = new TargetingSolution ({
X: 45,
y: 12,
z: -1
})
console.log(sln.target())
class TargetingSolution {
  constructor(config) {
    this.value = `(${config.x}, ${config.y}, ${config.z})`
    this.target = () => this.value;
  }
}

let m = new TargetingSolution({
  x: 10,
  y: 15,
  z: 900
});

console.log(m.target());

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM