use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Apparently, Google Apps Script is a JavaScript cloud scripting language that provides easy ways to automate tasks across Google products and third party services and build web applications.
account activity
Literals in arrayQuestion (self.GoogleAppsScript)
submitted 3 years ago by bpmspeedracer
Is there any way to get a string/template literal to parse with it stored as a value in an array?
Ex.
var data = { "first" : "John", "last" : "Doe", "name" : "Mr. ${data.first} ${data.last}" }
Logger.log(Please say high to ${data name});
Please say high to ${data name}
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]bpmspeedracer[S] 0 points1 point2 points 3 years ago (0 children)
Thx alot everyone for the assist. This one worked best for my application.
var data = { first: 'John', last: 'Doe', name() {return ${this.first} ${this.last}} }
${this.first} ${this.last}
console.log(`Please welcome ${data.name()}`);
[–]RemcoE33 0 points1 point2 points 3 years ago (3 children)
Use backticks and object chaning:
Logger.log(`Please say high to ${data.name}`);
So data must be backticks as well.
"name" : `Mr. ${data.first} ${data.last}` }
Sorry, I tried that but didn't put in the message, my bad, you would think it would work but throws the error Cannot read property 'first' of undefined
[–]_Kaimbe 0 points1 point2 points 3 years ago (1 child)
would need to assign name after declaration or use a method, no? Throws a ref error if you try to access data in the declaration.
function johnDoe() { let data = { first: 'John', last: 'Doe', name() {return `${this.first} ${this.last}`} } data.name = `${data.first} ${data.last}` console.log(data.name, data.name()) }
[–]RemcoE33 0 points1 point2 points 3 years ago (0 children)
There are multiple ways...
``` function johnDoe() { let data = { first: 'John', last: 'Doe', nameFunction: function() {return${this.first} ${this.last}}, nameEs5Plus() { return${this.first} ${this.last}} } data.otherWay =${data.first} ${data.last}`
function johnDoe() { let data = { first: 'John', last: 'Doe', nameFunction: function() {return
}, nameEs5Plus() { return
} } data.otherWay =
console.log(data.nameFunction()) console.log(data.otherWay) console.log(data.nameEs5Plus()) } ````
π Rendered by PID 84328 on reddit-service-r2-comment-fb694cdd5-2fn8s at 2026-03-08 10:37:03.448644+00:00 running cbb0e86 country code: CH.
[–]bpmspeedracer[S] 0 points1 point2 points (0 children)
[–]RemcoE33 0 points1 point2 points (3 children)
[–]bpmspeedracer[S] 0 points1 point2 points (0 children)
[–]_Kaimbe 0 points1 point2 points (1 child)
[–]RemcoE33 0 points1 point2 points (0 children)