Skip to content

Instantly share code, notes, and snippets.

@Ehawk82
Last active March 18, 2018 19:01
Show Gist options
  • Save Ehawk82/4f61f4e611e256f2697e1199bbaac96c to your computer and use it in GitHub Desktop.
Save Ehawk82/4f61f4e611e256f2697e1199bbaac96c to your computer and use it in GitHub Desktop.
My experience in learning JS
  1. Scope & Timeline. Troubleshooting takes time and it's painful when the problem is because of where something is written in respect to other things.

  2. "Return functions". I wish i learned to do this earlier. Instead of writing "document.get[thing]" over and over again sucks. So creating a return function in my global object is a great timesaver... something like UI.bySelect("#tag") and UI.byTag("body"). I believe this is also a good way to learn how to use parameters

  3. Parameters. Specifically about the scope of where a variable is named. I found that there are times where i'll use "x", "y" for a generic variable to pass as a parameter. This means the previous function will try to pass their variable in those spots. This is something to pay attention to when using more than two parameters

  4. Using setTimeout() to delay a className change. This is something that i spent a lot of time and code on to do things, only to find out that a simple timeout can delay a change momentarity. This is important when loading how i want users to see things. It would be cool to see a good way to combine this with the lesson on return functions, that way we can learn ways to minimize clutter.

  5. Large projects hurt me. I get excited, work hard, do the majority of the game, then give up because the amount of functions in the global scope becomes unbearable to maintain.

  6. Clarity and vision. I want to master what "vanilla" means in JavaScript, but i also feel like i needed more direction on the "whens & whys" behind using modern frameworks.

  7. How to set up a global object? In the beginning, i was just writing code in to a script tag directly on my HTML page. I had casually learned to link to a script. with that, i learned how to seek folders and directories in the src. The whole "why won't my javascript file load" thing was where i lurked on stackoverflow. When i learned how to properly link and load when ready was a hurdle, but looking back, was simpler than it could have been.

  8. JSON trouble. The learning curve on when to parse, when to stringify, when to call -or call again- an object in order to take that information and either display, append, save item.... it was hard. And i feel there are "magical" things we can do with JSON that no one even talks about... things like using timestamps in the keyname.

  9. Handling integers in localStorage. To this day, i still had no idea why i need to decorate my variables to do maths. I have seen people give me solutions that they say will work better, but it doesn't work, i got decorated variables that enable a function to work correctly and any change or attempt a refractor typically breaks the function.

  10. It would be nice to see an entire video dedicated to "best practices" from [stoneCyphers'] point of view.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment