-
I have a constant If I just do However, if I do: const passageIntxts = [];
if (wordsFiltered.length > 0) {
for (let i in wordsFiltered) {
let word = wordsFiltered[i];
let dirIntxts = word.directIntertextIDs;
passageIntxts.push(dirIntxts);
}} then I start having issues (calling On page refresh, and when I make an initial selection in my selectors, something causes I can give you the code that's producing Thanks in advance for any help! ETA: I tried pushing first the whole object and then just the object property, in order, to see what would happen, and here's what I get -- as you can see, it thinks the property The code for this is: const passageIntxts = [];
if (wordsFiltered.length > 0) {
for (let i in wordsFiltered) {
let word = wordsFiltered[i];
passageIntxts.push(word);
passageIntxts.push(word.directIntertextIDs);
}} So something really isn't making a whole lot of sense. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I solved half of the issue, but not the other half, so I'd still appreciate understanding what's going on. I had defined |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
You shouldn’t mutate a variable defined in another cell (without understanding the consequences). If you mutate a variable defined in another cell, then it’s likely that other cells will see the variable in an underdefined state. For example, consider these three cells:
There’s no guarantee that the third cell here will see the value of
foo.bar
as"bar"
; it could be undefined if the third cell happens to run before the second cell. The only guarantee is that the second and third cell run after the first cell (because the first cell definesfoo
, while the second and third cells referencefoo
). The evaluation graph looks like this:What yo…