Another one to the book baby
Midnight greetings, my dear world; I'm in my room, the night is silent, and I'm listening to some music. Such a perfect situation to start working on something!
I don't even know what I'll work on yet; actually, I don't even know what I'm going to name this post!
Ok, so I was taking a look at the JavaScript code of the WCI, and found this inside a function:
1 2 3 4 5 6 7 8 9 10 | if(usuario == true) { estructura_mensaje.classList.add("originalmente2") estructura_mensaje.classList.add("friend_msg"); } else if(usuario == false) { estructura_mensaje.classList.add("originalmente1"); estructura_mensaje.classList.add("my_msg"); } |
If you recall from the Quick Lessons in Optimization post, repetitive code is malpractice, so I'll try to optimize it a little bit.
So, after a little tweaking, the code now looks like this:
1 2 | estructura_mensaje.classList.add(usuariooriginal); estructura_mensaje.classList.add(usuariotag); |
Now, we only need to pass the arguments when calling the function, commit the changes to my GitHub repo, and that's it, it works perfectly.
Comments
Post a Comment