9.22 Study Log

1.75h I FIGURED OUT MY BUG FROM LAST NIGHT!!!

Recap of the bug is: I was copying an array to a different array, but it wasn’t copying, it was just acting like a pointer to the first array. The reason why is that the initial array had other arrays inside of it, so while the main array was copied correctly, the nested arrays weren’t copied the right way!

I fixed this line

let initialCID=[] //this doesn't work
initialCID.push(...cid)
with this line
let initialCID=[] //this works!
for (let i=0;i<cid.length;i++){
    initialCID.push([...cid[i]])
}

In case you missed it, the fix iterates through the cid to find each element, and then it spreads it out into my initialCID. I also could have use cid[i].slice() instead of […cid[i]]

Tonight I restarted the flatiron bootcamp prep. I’m midway through the javascript section, but I’m re doing all of it because this is the first time I have really dealt with the dom. Previously I think I liked the flatiron in-browser IDE, but now it feels cumbersome since I can’t debug to the console. I’ve been copying the html locally and running it in chrome whenever possible.

 

 

Tell me what you think.

This site uses Akismet to reduce spam. Learn how your comment data is processed.