【问题标题】:display add on value in the console在控制台中显示附加值
【发布时间】:2018-09-23 04:59:21
【问题描述】:
  • 我是 js 新手。
  • 我正在尝试在控制台中显示附加值。
  • 我不知道如何访问插件。
  • 你能告诉我如何解决它吗?
  • 在下面提供我的代码。

https://jsfiddle.net/6f8upe80/

private sports: any = {
        networkNo: 241,
        startDate: "04/10/2018",
        endDate: "04/24/2018",
        addOns: [
            "sports"
        ]

    }
  //console.log("this--->" , this);
  console.log("this.sports.addOns--->" + this.sports.addOns);

【问题讨论】:

  • 您收到什么错误?

标签: javascript jquery html angularjs typescript


【解决方案1】:

如果您只是想找到一种访问值的方法,您可以在本地范围内声明变量并访问它。

let sports: any = {
    networkNo: 241,
    startDate: "04/10/2018",
    endDate: "04/24/2018",
    addOns: [
        "sports"
    ]

}
console.log("this.sports.addOns--->" + sports.addOns);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多