DEV Community

Cover image for My experience learnig JavaScript.
NathanWelliver
NathanWelliver

Posted on

My experience learnig JavaScript.

How I got into coding

I got my first taste of coding when I went to my community college for an IT Certificate. While there, I learned a little bit of Python, but only a couple of assignments and one little project. In that short time that I worked with Python I realized that I wanted to continue to work with code.

Finding my school

After I found what interested me in my IT course, I began to look for schools that would teach me while I continued to work my job. One day I was talking to my neighbor about jobs and career paths and he said he worked with code for a large company. He and his wife both went to Flatiron school for software engineering, about a week or two after they graduated from Flatiron they already had found jobs. With some research and some help from their support team, I was able to decide to go to school at Flatiron. One of the best things about them is that they can give me a superb education and working experience while in class. If you ever get stuck on an assignment you have the ability to call on a Tech coach that can help you through the assignment. They also provide an AI assistant that can help you find coding errors or help provide an in-depth explanation of the code you are working on and how it works. The counselors that you work with are amazingly friendly and are there whenever you need them. The systems that they have in place for contacting and finding help are super simple. The tech coaches also are usually always available unless it is past midnight. I find that amazing to have access to all the time while coding. Everything that they have set in place to help you learn and grow your knowledge about coding is amazing!

What I have learned so far

I started my coding journey learning JavaScript with Flatiron. The layout and form of learning that they provide you with is incredible. You have lectures happening all the time that you can go back to, if recorded, to relearn or remember. Labs that test you on the ability to apply the recently learned topic in a way that makes you think. One of my favorite labs to do was the Toy Tale lab. This is where I learned to use fetch(). Fetch() is used to make a "GET", "POST", and "PATCH" request to modify the DOM(document object model). For example, if you want to display/update the toy card you would have to fetch them from the server.

// Function to fetch toys and display them
  function fetchToysAndDisplay() {
    fetch("http://localhost:3000/toys")
      .then(response => response.json())
      .then(toys => {
        toys.forEach(toy => {
          const card = createToyCard(toy);
          toyCollection.appendChild(card);
        });
      });
  }
Enter fullscreen mode Exit fullscreen mode

Now if you wanted to post a new toy to the website you'd need to add a button and section on the page to input the information needed to create a new toy. Then you would code in the button's functionality into the project like so:

// Function to create a toy card
  function createToyCard(toy) {
    const card = document.createElement("div");
    card.className = "card";

    const h2 = document.createElement("h2");
    h2.textContent = toy.name;

    const img = document.createElement("img");
    img.src = toy.image;
    img.className = "toy-avatar";

    const p = document.createElement("p");
    p.textContent = `${toy.likes} Likes`;

    const button = document.createElement("button");
    button.className = "like-btn";
    button.textContent = "Like";
    button.dataset.id = toy.id;

    button.addEventListener("click", () => {
      toy.likes++;
      p.textContent = `${toy.likes} Likes`;
      updateToyLikes(toy);
    });

    card.appendChild(h2);
    card.appendChild(img);
    card.appendChild(p);
    card.appendChild(button);

    return card;
  }
Enter fullscreen mode Exit fullscreen mode

I have had a ton of fun with this project not just by creating/writing the code to make the project work. But also being able to create the toy card on the website just with a little bit of coding experience. I have improved so much in a short amount of time with Flatiron. They have helped me to push myself to continue on the career path that I have chosen. That is why I would recommend working with FlatIron if you are looking to get into software.

Top comments (0)