Merde! Merde! Merde! Merde! Merde! Merde! Merde! Merde! Merde!

Or, if Napoleon (as quoted in Bill and Ted’s Excellent Adventure) isn’t your thing and you prefer German historical figures (as recorded for posterity in Inglorious Basterds) …

Nein! Nein! Nein! Nein! Nein! Nein!

Or, if you voted for Trump …

JavaScript is rigged. Bad!

I was so right to be skeptical. I’ve spent the last twelve days neglecting my family — except to yell at them to leave me alone — while I’ve worked in vain to debug this code. I was SO cruising … or thought so …

While I’ve found multiple new ways to break my code while “fixing” it, the problem boils down to one of two outcomes. I either get

  • Figure A. 37 different albums, each with the correct tracks but the tracks have “undefined” popularity, or
  • Figure B. 37 copies of the same album with the correct tracks which have a popularity value
Figure A
Figure B

After looking at the code, the console in Figure B shouldn’t even give me that much because of where the log lives in the code — it shouldn’t return any albums at all. I think it only does if I haven’t cleared the cache but I’m not sure because I’m trying so many different things in succession. I’m fighting in the dark here in several ways.

Depending on which “solution” I’m trying (for the Nth time), I might get

  • 37 copies of the same album but with tracks from different albums
  • 37 different albums with no tracks
  • 37 different albums each with 432 tracks
  • 2 albums — one with no tracks and the other with tracks that have a popularity value
  • Linda Blair projectile vomiting countless errors from the console
  • and more

I think what I just have to do is rebuild it from scratch using everything I’ve learned to this point instead of trying to fix one or both of those first two that are each almost perfect in their own way.

Each time, the results in the console are different and it’s unpredictable what will come up because of the asynchronous aspect of it (and, I think, whether or not I clear the browser cache between changes) so I really can’t tell with any certainty what difference my most recent change(s) made.

Two weeks ago, I thought for sure I was mere days away from being the most in-demand developer in history. Progress gives me hope and confidence. This makes me feel I’ll be trapped in my cubicle forever and that is as good as it gets for me.


2 thoughts on “Merde! Merde! Merde! Merde! Merde! Merde! Merde! Merde! Merde!

  1. i dont do heavy lifting in javascript, so im probably not going to be able to help you with this. guessing here– theres probably something wrong with the way youre doing arrays.

    in python for example, you can run into trouble having lists of lists– a list is a multitype array in python (and javascript has weak typing, which is even worse when something isnt working though it can make some things easier.)

    one of the problems you can have in python– and im telling you this just in case it helps you find the problem in your code– is that you can end up copying arrays (lists, but i will call them arrays from now on to avoid making it still more confusing) in a way that actually just links them (kind of like a shortcut icon in windows.)

    if you change the new array copy, it can affect the old one because theyre linked, and all kinds of confusion can happen. if i were you id focus on learning how to work properly with arrays– because youre probably mostly doing what you should already, but this is one area where “mostly” can get you into this sort of trouble… if javascript arrays have anything in common with python lists at all. i wouldnt have thought so, until you started describing your problem.


    1. This project started off in Python but I couldn’t get something to work that I was more confident doing in JS so I’ve done it in JS since then. I don’t want to move onto something else though I’m tempted with PHP. I want to solve the problem, not take an easy way out.

      Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s