问题
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