Read the statement by Michael Teeuw here.
How to declare an array in config.js?
-
@fischershaw - Try double quotes. The
"
character.biff: ["muffy","sport","spam"],
Don’t forget the trailing comma.
-
@bhepler Yes, the trailing comma is present. The config.js file is syntactically correct, it just produces unexpected results. In this case a string instead of an array.
-
@fischershaw @bhepler the way you have done it works for me…
from my MyCovid19 module
in config.jsconfig:{ countries:["Italy","USA","China","Spain", "France",'Sweden'],
in my code
for(var i in this.config.countries){ switch(this.config.countries[i].toLowerCase()) {
oh, single or double quotes doesn’t matter, even in the same array, long as they are matched
why do you think it is a string? its an array of strings
-
open the developers window, (npm start dev or ctrl-shift-i on the keyboard),
-
select the sources tab,
-
look thru the items on the left, expand modules, find your module, click its .js file ,
-
then put a stop (click on the line edge to the left of the 1st statement after start),
-
then hit f5 (refresh page) and the page will be reloaded and the debugger will stop on that statement,
-
u can examine the variables in the config object
-
-
@sdetweil My dumb error which I corrected. Sorry to bother you.
-
@fischershaw is ok, we all learn… I just spent 2 hours trying to figure out why an api request failed, 404 not found
I had spelled apikey with an uppercase K…
which debugging approach did you use?