“com.au” string is displayed as “(class)” in Script Editor

我怕爱的太早我们不能终老 提交于 2021-02-02 03:45:10

问题


I need to store an Australian domain as a string. Australian domains end with ".com.au"

Google Scripts seems to be displaying all instances of ".com.au" with "(class)".

To reproduce, create a basic function in Google Apps Scripts as follows:

function myFunction() {
  var x = "com.au";
  console.log("x: " + x);
  var z = 1;   //<--create break point here
}

Create a breakpoint at var z = 1, and then debug the script.

Actual Results:

In the console (at breakpoint):

x: (class)

Expected Results:

x: "com.au"

*Note: upon further testing, from a practical perspective, "(class)" seems to still be treated as "com.au" so this is not a blocker to use, but it is odd and does not help when debugging.


回答1:


This issue was reported as a bug to Google: https://issuetracker.google.com/issues/114358543




回答2:


This looks to be a bug of the Google Apps Script editor debugger that should be reported to Google. Please follow the directions on https://developers.google.com/apps-script/support#bugs.




回答3:


I just got around this bug with the use of an Array.

function myFunction() {
  var array = new Array();
  var text ="email@email.com.br";
  array[0] = string; 
}

text returns email@email.(class)

array[0] returns email@email.com.br



来源:https://stackoverflow.com/questions/52231226/com-au-string-is-displayed-as-class-in-script-editor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!