<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Michael Friedman</title>
    <description>The latest articles on DEV Community by Michael Friedman (@minorpianokeys).</description>
    <link>https://dev.to/minorpianokeys</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1171705%2F9240c9f8-0309-452d-9bb6-a1a59e942923.png</url>
      <title>DEV Community: Michael Friedman</title>
      <link>https://dev.to/minorpianokeys</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/minorpianokeys"/>
    <language>en</language>
    <item>
      <title>How I Integrated Cloudinary into My Music Sharing Project</title>
      <dc:creator>Michael Friedman</dc:creator>
      <pubDate>Mon, 14 Oct 2024 20:08:03 +0000</pubDate>
      <link>https://dev.to/minorpianokeys/how-i-integrated-cloudinary-into-my-music-sharing-project-1c7m</link>
      <guid>https://dev.to/minorpianokeys/how-i-integrated-cloudinary-into-my-music-sharing-project-1c7m</guid>
      <description>&lt;p&gt;As a web developer, I’m always on the lookout for solutions that can streamline the process of handling media files. Recently, I had the opportunity to work on a music sharing application where users could upload audio tracks and corresponding artwork. I decided to use Cloudinary, a powerful cloud-based media management service, to handle all our media uploads seamlessly. In this blog post, I will walk you through how I integrated Cloudinary into my project and the advantages it brought.&lt;/p&gt;

&lt;p&gt;Why Cloudinary?&lt;br&gt;
Cloudinary offers a range of features for handling images and videos, including easy uploads, automatic image optimization, and responsive delivery. The ability to manage both audio and image files makes it an ideal solution for a music application where each track requires an audio file and associated artwork.&lt;/p&gt;

&lt;p&gt;Setting Up Cloudinary&lt;br&gt;
The first step was to create a Cloudinary account and set up an upload preset that defines how the files would be uploaded. I configured it for both image and audio uploads, specifying any transformations needed.&lt;/p&gt;

&lt;p&gt;File Upload Process&lt;br&gt;
In my project, I created a component called AddTrack that allows users to input track details and upload their audio and image files.&lt;/p&gt;

&lt;p&gt;How It Works&lt;br&gt;
File Selection: The user selects an audio file and an image file through the file inputs in the form.&lt;br&gt;
Form Data Preparation: I prepare two separate FormData objects, one for the audio file and another for the image file.&lt;br&gt;
Upload to Cloudinary: Using Axios, I send a POST request to Cloudinary's API for both files. Cloudinary handles the uploads and returns URLs for the uploaded files.&lt;br&gt;
Data Submission: After receiving the URLs, I compile the track data, including the Cloudinary URLs, and send it to my backend server to create the new track.&lt;br&gt;
User Feedback: If there’s an error during the upload or submission process, I display an alert to the user using SweetAlert2.&lt;br&gt;
Benefits of Using Cloudinary&lt;br&gt;
Efficiency: Cloudinary manages media files efficiently, allowing me to focus on building features rather than dealing with file storage and delivery issues.&lt;br&gt;
Optimized Delivery: Cloudinary automatically optimizes images and audio for different devices, which enhances the user experience.&lt;br&gt;
Ease of Use: The API is straightforward and integrates seamlessly with my React application, making it easy to upload and manage media files.&lt;br&gt;
Scalability: As my application grows, Cloudinary can handle increased media traffic without additional setup.&lt;br&gt;
Conclusion&lt;br&gt;
Integrating Cloudinary into my music sharing project has significantly improved how I handle media uploads. The process is straightforward, efficient, and provides users with a seamless experience. As I continue to develop this application, I look forward to exploring more features that Cloudinary offers, such as video transformations and advanced image management. Overall, if you're looking for a reliable solution for managing media files in your projects, I highly recommend giving Cloudinary a try!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>SQLAlchemy: The Powerhouse of ORMs</title>
      <dc:creator>Michael Friedman</dc:creator>
      <pubDate>Sun, 01 Sep 2024 17:46:30 +0000</pubDate>
      <link>https://dev.to/minorpianokeys/sqlalchemy-4f4p</link>
      <guid>https://dev.to/minorpianokeys/sqlalchemy-4f4p</guid>
      <description>&lt;p&gt;When working with databases in Python, one of the most powerful tools at your disposal is SQLAlchemy. It's an Object-Relational Mapping (ORM) library that allows developers to interact with databases using Pythonic code, abstracting the complexities of SQL queries while maintaining the flexibility to write raw SQL when needed. SQLAlchemy is well-regarded for its robustness, flexibility, and efficiency, making it a go-to choice for many Python developers.&lt;/p&gt;

&lt;p&gt;In this blog post, I'll explore the basics of SQLAlchemy, discuss its core components, and walk through some coding examples to demonstrate how you can integrate it into your Python projects.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why SQLAlchemy?
&lt;/h1&gt;

&lt;p&gt;SQLAlchemy is not just another ORM. It’s designed to handle a wide range of tasks and use cases, from small projects with simple data models to complex applications with multiple databases and intricate relationships. Here are a few reasons why SQLAlchemy stands out:&lt;/p&gt;

&lt;p&gt;ORM and Core: SQLAlchemy offers both high-level ORM capabilities and a lower-level SQL Expression Language, known as the Core, allowing you to choose the level of abstraction that best suits your needs.&lt;br&gt;
Flexibility: You can use SQLAlchemy with any SQL database, such as SQLite, PostgreSQL, MySQL, and others. Switching between databases is as simple as changing the connection string.&lt;br&gt;
Scalability: Whether you're working on a small project or a large-scale application, SQLAlchemy scales to meet your needs.&lt;/p&gt;

&lt;p&gt;Setting Up a Basic SQLAlchemy Model&lt;br&gt;
Let's start with a simple example of defining a model using SQLAlchemy's ORM. My most recent application manages a list of theme park rides.&lt;/p&gt;

&lt;p&gt;python&lt;br&gt;
from sqlalchemy import create_engine, Column, Integer, String&lt;br&gt;
from sqlalchemy.ext.declarative import declarative_base&lt;br&gt;
from sqlalchemy.orm import sessionmaker&lt;/p&gt;

&lt;h1&gt;
  
  
  Set up the database connection
&lt;/h1&gt;

&lt;p&gt;engine = create_engine('sqlite:///books.db', echo=True)&lt;/p&gt;

&lt;h1&gt;
  
  
  Base class for our models
&lt;/h1&gt;

&lt;p&gt;Base = declarative_base()&lt;/p&gt;

&lt;h1&gt;
  
  
  Define the Ride model
&lt;/h1&gt;

&lt;p&gt;class Ride(db.Model, SerializerMixin):&lt;br&gt;
    &lt;strong&gt;tablename&lt;/strong&gt; = 'rides'&lt;br&gt;
    id = db.Column(db.Integer, primary_key=True)&lt;br&gt;
    name = db.Column(db.String)&lt;br&gt;
    image = db.Column(db.String)&lt;br&gt;
    description = db.Column(db.String)&lt;br&gt;
    height = db.Column(db.String)&lt;/p&gt;

&lt;h1&gt;
  
  
  Create the Rides table
&lt;/h1&gt;

&lt;p&gt;Base.metadata.create_all(engine)&lt;br&gt;
Understanding the Code&lt;/p&gt;

&lt;p&gt;Engine: The create_engine function sets up the connection to the database. In this example, we're using SQLite, a lightweight database that's great for development.&lt;/p&gt;

&lt;p&gt;Base: declarative_base() returns a base class that our models will inherit from. This base class keeps track of all the models you define, allowing SQLAlchemy to create tables based on them.&lt;br&gt;
Model: The Ride class is a model that represents a table in the database. Each attribute in the class corresponds to a column in the table.&lt;/p&gt;

&lt;p&gt;Table Creation: Base.metadata.create_all(engine) tells SQLAlchemy to create the tables in the database based on the models defined.&lt;/p&gt;

&lt;h1&gt;
  
  
  Creating and Querying Records
&lt;/h1&gt;

&lt;p&gt;With the model defined, let's move on to creating a new record and querying the database.&lt;/p&gt;

&lt;p&gt;class Rides(Resource):&lt;br&gt;
    def get(self):&lt;br&gt;
        rides = [r.to_dict(rules=('-park', '-reviews',)) for r in Ride.query.all()]&lt;br&gt;
        return rides, 200&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def post(self):

    try:
        new_ride = Ride(
            name = request.json['name'],
            image = request.json['image'],
            description = request.json['description'],
            height = request.json['height'],
            park_id = request.json['park_id']
        )
        db.session.add(new_ride)
        db.session.commit()
        return new_ride.to_dict(), 201

    except:
        return {"errors": ["validation errors"]}, 400
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Explanation&lt;br&gt;
We use a POST request to create a new resource and a GET request to retrieve data from the server.&lt;/p&gt;

&lt;p&gt;Session: A session in SQLAlchemy is a workspace for interacting with the database. It allows you to add, delete, and query records.&lt;/p&gt;

&lt;p&gt;Adding Records: To add a record, you instantiate the model class, populate it with data, and add it to the session. session.commit() writes the changes to the database.&lt;/p&gt;

&lt;p&gt;Querying: You can query the database using session.query(), which returns a list of all records in the specified table.&lt;/p&gt;

&lt;h1&gt;
  
  
  Advanced SQLAlchemy: Relationships
&lt;/h1&gt;

&lt;p&gt;SQLAlchemy supports defining relationships between models, allowing you to represent complex data structures. Here’s a quick example of a one-to-many relationship between a Theme Park and it's many Rides:&lt;/p&gt;

&lt;p&gt;from sqlalchemy import ForeignKey&lt;br&gt;
from sqlalchemy.orm import relationship&lt;/p&gt;

&lt;p&gt;class Ride(db.Model, SerializerMixin):&lt;br&gt;
    &lt;strong&gt;tablename&lt;/strong&gt; = 'rides'&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String)
image = db.Column(db.String)
description = db.Column(db.String)
height = db.Column(db.String)

park_id = db.Column(db.Integer, db.ForeignKey('parks.id'))
park = db.relationship('Park', back_populates='rides')

serialize_rules = ('-park.rides',)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;class Park(db.Model, SerializerMixin):&lt;br&gt;
    &lt;strong&gt;tablename&lt;/strong&gt; = 'parks'&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String)
image = db.Column(db.String)

rides = db.relationship('Ride', back_populates='park', cascade='all, delete-orphan')

serialize_rules = ('-rides.park',)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Explanation&lt;br&gt;
Relationships: The relationship() function creates a relationship between two models. In this case, each Park can have multiple Ride records, and each Ride has a single Park.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;SQLAlchemy is a versatile and powerful ORM that can greatly simplify the process of working with databases in Python. Whether you're building a simple application or a complex system, SQLAlchemy provides the tools and flexibility you need to manage your data effectively.&lt;/p&gt;

&lt;p&gt;With its ability to scale, support multiple databases, and offer both high-level ORM features and low-level SQL expression capabilities, SQLAlchemy is an essential tool for any Python developer working with databases.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Exploring the Power of Python and Object-Oriented Programming</title>
      <dc:creator>Michael Friedman</dc:creator>
      <pubDate>Wed, 03 Jul 2024 02:33:53 +0000</pubDate>
      <link>https://dev.to/minorpianokeys/exploring-the-power-of-python-and-object-oriented-programming-4ai3</link>
      <guid>https://dev.to/minorpianokeys/exploring-the-power-of-python-and-object-oriented-programming-4ai3</guid>
      <description>&lt;p&gt;Python, a versatile and widely-used programming language, is known for its simplicity and readability. One of its most powerful features is its support for Object-Oriented Programming (OOP). OOP is a programming paradigm that uses objects and classes to structure software programs. It allows developers to create modular, reusable code, which is essential for managing large and complex applications. In this blog post, we will delve into the fundamentals of OOP in Python and explore how it can enhance your programming skills.&lt;br&gt;
Understanding Object-Oriented Programming&lt;br&gt;
At the heart of OOP are objects and classes. A class is a blueprint for creating objects. It defines a set of attributes and methods that the created objects will have. An object, on the other hand, is an instance of a class. Think of a class as a cookie cutter and objects as the cookies made from that cutter. Each cookie (object) can have different decorations (attribute values), but they all share the same basic shape and ingredients (structure and behavior).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Very Essential and Powerful &lt;strong&gt;init&lt;/strong&gt; method&lt;/strong&gt;&lt;br&gt;
In Python, the &lt;strong&gt;init&lt;/strong&gt; method is a special constructor method used to initialize newly created objects. It is automatically called when a new instance of a class is created, allowing you to set initial values for the object's attributes and perform any setup tasks required. The &lt;strong&gt;init&lt;/strong&gt; method takes at least one argument, self, which refers to the instance being created. Additional parameters can be passed to &lt;strong&gt;init&lt;/strong&gt; to initialize the attributes of the object. For example, in a Car class, &lt;strong&gt;init&lt;/strong&gt; might take parameters like make, model, and year to set the corresponding attributes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Implementing OOP in Python&lt;/strong&gt;&lt;br&gt;
Let's explore how these principles are implemented in Python with an example. Suppose we are building a simple library management system.&lt;/p&gt;

&lt;p&gt;class Book:&lt;br&gt;
    def &lt;strong&gt;init&lt;/strong&gt;(self, title, author):&lt;br&gt;
        self.title = title&lt;br&gt;
        self.author = author&lt;/p&gt;

&lt;p&gt;We have initialized the Book class with a title and author that will be saved to each Book class we create.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Talking to Your Database With SQL&lt;/strong&gt;&lt;br&gt;
SQL (Structured Query Language) is a powerful and standardized language used to communicate with relational databases. It enables users to create, read, update, and delete (CRUD) data stored in a database, as well as manage database structures. SQL's declarative nature allows users to specify what data they need without detailing the procedural steps to retrieve it. Key components of SQL include queries for data retrieval (SELECT), commands for data manipulation (INSERT, UPDATE, DELETE), and statements for schema creation and modification (CREATE, ALTER, DROP). &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bringing Both Worlds Together&lt;/strong&gt;&lt;br&gt;
Object-Relational Mapping (ORM) is a programming technique that enables developers to interact with a relational database using the object-oriented paradigm of their programming language. By creating a bridge between the data structures in a relational database and the objects in Python, ORM tools simplify database interactions. Instead of writing raw SQL queries, developers can perform database operations using the language's constructs. This abstraction enhances code readability, maintainability, and productivity by allowing developers to work with database records as if they were regular objects. I used SQLite in Python in my Phase 3 Project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CLI Programs&lt;/strong&gt;&lt;br&gt;
Command-Line Interfaces (CLIs) provide users with a text-based way to interact with computer programs and operating systems. Unlike graphical user interfaces (GUIs) which rely on visual elements like windows and buttons, CLIs require users to type commands into a terminal or console. CLIs allow for precise control over system resources and software configurations through commands that execute tasks ranging from file manipulation and software installation to network management and process monitoring. CLIs are platform-independent, making them suitable for both local and remote system management. While they may have a steeper learning curve compared to GUIs, CLIs offer advantages such as scriptability, rapid execution of repetitive tasks, and the ability to operate in low-resource environments or headless servers. As software development and system administration continue to evolve, CLIs remain indispensable tools for those who value speed, precision, and direct control over their computing environments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Python's support for Object-Oriented Programming (OOP) empowers developers with a structured and efficient approach to building software systems. By leveraging classes, objects, and the versatile &lt;strong&gt;init&lt;/strong&gt; method, developers can create modular and reusable code that scales well with project complexity. Integrating SQL for database interactions and utilizing Object-Relational Mapping (ORM) tools further enhances Python's capabilities, enabling seamless integration of database operations within OOP principles. Additionally, Command-Line Interfaces (CLIs) extend Python's versatility by providing robust, text-based interaction with systems, offering precise control and automation capabilities. Together, these features show off Python's adaptability across diverse applications, from web development to data science and system administration, making it a cornerstone in modern software engineering.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Phase 2: Navigating the React Universe: Components, Props, and State</title>
      <dc:creator>Michael Friedman</dc:creator>
      <pubDate>Mon, 20 Nov 2023 19:48:41 +0000</pubDate>
      <link>https://dev.to/minorpianokeys/navigating-the-react-universe-components-props-and-state-1fk5</link>
      <guid>https://dev.to/minorpianokeys/navigating-the-react-universe-components-props-and-state-1fk5</guid>
      <description>&lt;p&gt;Welcome to the transformative world of React, a JavaScript library that has revolutionized the way we approach web development. Born out of Facebook's desire to create more efficient and interactive user interfaces, React has become a cornerstone in modern front-end development. What sets React apart is its component-based architecture, empowering developers to break down complex UIs into modular, reusable pieces. This not only enhances code organization but also fosters a more maintainable and scalable codebase. In this introduction, we'll embark on a journey through the key concepts of React, exploring its declarative nature, component-based structure, and the magic of the virtual DOM—all of which contribute to its widespread adoption and unparalleled developer experience. Whether you're a seasoned developer or just starting on your coding adventure, React's simplicity, efficiency, and versatility make it an indispensable tool for crafting engaging and dynamic web applications.&lt;/p&gt;

&lt;p&gt;In React, a component is like a self-contained building block, encapsulating both the UI and the functionality related to a specific part of the application. These modular entities can range from simple elements like buttons or forms to more complex entities such as entire sections of a webpage. The beauty of components lies in their reusability – you can use them across different parts of your application or even in entirely different projects. React's component-based architecture fosters a modular and maintainable code structure, making it easier for developers to reason about and manage their codebase. Whether you're creating a small application or a large-scale project, understanding and effectively utilizing components is key to harnessing the power and flexibility that React brings to modern web development.&lt;/p&gt;

&lt;p&gt;Let's kick things off with a simple example of a functional component:&lt;/p&gt;

&lt;p&gt;import React from 'react'; &lt;br&gt;
const Greeting = () =&amp;gt; { return (&lt;/p&gt;

&lt;h1&gt;Hello, React!&lt;/h1&gt; 
 

&lt;p&gt;); &lt;br&gt;
}; &lt;/p&gt;

&lt;p&gt;export default Greeting;&lt;/p&gt;

&lt;p&gt;Here, we've defined a basic functional component called Greeting. It's a self-contained snippet of UI that renders a greeting message.&lt;/p&gt;

&lt;p&gt;In the real world, components often need to communicate and share information. React achieves this through "props". In the realm of React, "props" stands as a crucial mechanism for facilitating communication between components. Short for properties, props are a way to pass data from a parent component to its children, enabling dynamic customization and rendering. Think of props as the messenger that delivers specific information to a component, influencing its behavior and appearance. This not only promotes reusability but also establishes a clear and efficient flow of data within a React application. Components that receive props can dynamically adjust their rendering based on the values provided, creating a flexible and interactive user interface. As a fundamental concept in React's component architecture, mastering the art of props unlocks the ability to build modular and extensible applications, where each component seamlessly collaborates within the larger ecosystem.&lt;/p&gt;

&lt;p&gt;import React from 'react'; &lt;br&gt;
const PersonalizedGreeting = (props) =&amp;gt; { &lt;br&gt;
return &lt;/p&gt;
&lt;h1&gt;Hello, {props.name}!&lt;/h1&gt;; &lt;br&gt;
}; &lt;br&gt;
const App = () =&amp;gt; { &lt;br&gt;
return ; &lt;br&gt;
}; 

&lt;p&gt;export default App;&lt;/p&gt;

&lt;p&gt;In this example, the PersonalizedGreeting component receives a prop named name and dynamically displays a personalized greeting. Props facilitate the flow of data between components.&lt;/p&gt;

&lt;p&gt;While props help with external communication, React components also have a memory of their own—called "state." Unlike props, which facilitate the flow of data from parent to child components, state is an internal data storage mechanism for a component. It enables components to manage dynamic information and ensures that the user interface remains in sync with changes in the underlying data. State is particularly crucial for handling user interactions, such as form inputs or dynamic content updates, as it allows components to re-render and reflect the most up-to-date information. The introduction of the useState hook in functional components has streamlined the management of state, making it more intuitive and declarative. Through the judicious use of state, React applications become not just static views, but dynamic and interactive user experiences.&lt;/p&gt;

&lt;p&gt;import React, { useState } from 'react'; &lt;br&gt;
const Counter = () =&amp;gt; { &lt;br&gt;
const [count, setCount] = useState(0); &lt;br&gt;
const increment = () =&amp;gt; { setCount(count + 1); }; return ( &lt;/p&gt;

&lt;p&gt;Count: {count}&lt;/p&gt; 

&lt;p&gt;Increment &lt;/p&gt;

&lt;p&gt;); &lt;br&gt;
}; &lt;/p&gt;

&lt;p&gt;export default Counter;&lt;/p&gt;

&lt;p&gt;In this snippet, the Counter component maintains its count using the useState hook. When the user clicks the "Increment" button, the component updates its state and re-renders, providing a responsive and interactive experience.&lt;/p&gt;

&lt;p&gt;In this exploration of React components, we've touched on the essence of these powerful building blocks. Components empower developers to create scalable, modular, and responsive applications. As you venture further into the React universe, honing your understanding of components will be key to unlocking the full potential of this library.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Phase 1: Catching up with JavaScript</title>
      <dc:creator>Michael Friedman</dc:creator>
      <pubDate>Wed, 27 Sep 2023 18:51:43 +0000</pubDate>
      <link>https://dev.to/minorpianokeys/phase-1-catching-up-with-javascript-4jg2</link>
      <guid>https://dev.to/minorpianokeys/phase-1-catching-up-with-javascript-4jg2</guid>
      <description>&lt;p&gt;I started learning JavaScript at FlatIron School almost two months ago. After learning JavaScript three years ago, I thought I would breeze through this phase. Little did I know how quickly things can leave your brain. At the beginning it was rough to get back into something I haven't done in three years. Once I got the hang of it, it felt like riding a bike. The main the I noticed about this program is the way they teach code. The last program I did taught me "cool" and "fancy" things I can do with code to make a website look neat. This program is actually diving in how the code works, giving me a better understand of when and how to use certain methods. For example, instead of just teaching me what .map() does, I now know how to build that code from scratch and exactly how it works under the hood.&lt;/p&gt;

&lt;p&gt;I find it fascinating that there are always endless ways to solve one problem. This blew my mind when for loops pretty much became extinct in my code when I learned different ways to iterate through arrays and objects.&lt;/p&gt;

&lt;p&gt;To iterate through this array:&lt;br&gt;
Const arr = [1, 2, 3]&lt;/p&gt;

&lt;p&gt;This code:&lt;br&gt;
for (let i = 0;  i &amp;lt; i arr.length ; i++) {&lt;br&gt;
    console.log(“Hi”)&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;Became this code:&lt;br&gt;
for (i in arr) {&lt;br&gt;
 console.log(“Hi”)&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;Which became this code:&lt;br&gt;
arr.forEach(() =&amp;gt; console.log(“Hi”))&lt;/p&gt;

&lt;p&gt;As you can see as I learned more through this program, I am able to not only shorten my code, but also make it easier to read. &lt;/p&gt;

&lt;p&gt;Another amazing thing I discovered about JavaScript is how much you can do with such little code. A simple click event in one to two lines of code will make a button come to life! JavaScript methods like .filter() and .reduce() can do a ton of code with just that one word. Our code can shrink as we learn more as seen above. I think nothing compares to the power of APIs. APIs are some of the easiest and best ways to expand your code. It’s amazing that the coding community shares and uses each others code to give and send information. I can have every name, type, number, stat of every Pokemon to exist at my finger tips with a simple GET request. That’s exactly what I did with my Phase 1 project, until I hit a bump in the road.&lt;/p&gt;

&lt;p&gt;As frustrating as it is, I think debugging is my favorite part about coding. It’s what coding is all about: problem solving. In my Phase 1 Project, I had a huge bug which was not allowing me to move forward in my project. I looked through my code over and over again and saw nothing wrong. After a lot of googling, I finally came up with a possible solution. Here is the code with my bug:&lt;/p&gt;

&lt;p&gt;function handleNewPoke() {&lt;br&gt;
        //Fetch Pokemon&lt;br&gt;
        const randomPokeNum = Math.floor(Math.random() * 151)&lt;br&gt;
        fetch(&lt;code&gt;https://pokeapi.co/api/v2/pokemon/${randomPokeNum}&lt;/code&gt;)&lt;br&gt;
        .then(res =&amp;gt; res.json())&lt;br&gt;
        .then(function(data) {&lt;br&gt;
            const pokeName = data.name;&lt;br&gt;
            const pokeImage = data.sprites.other["official-artwork"].front_default;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;      //Handle Form
      guessForm.addEventListener('submit', function(e) {
          e.preventDefault()
          const userGuess = guessForm.guess.value.toLowerCase();
          console.log(userGuess)
          if(userGuess == pokeName) {
              console.log("correct")
          } else {
              console.log("incorrect")
          }
        })  
    })
}  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;When my handleNewPoke() function runs, I am fetching information from an API and getting a name and image. I then have an event listener on a form which tells me if my guess equals the name of the Pokemon I fetched from the API. I found that every time I ran this function I was adding a new event listener. If this function ran 5 times, I would have 5 event listeners on that form. So even if my guess was correct, it would be incorrect for the other 4 event listeners. I didn’t know event listeners worked that way!&lt;/p&gt;

&lt;p&gt;My solution was taking that event listener and putting it outside the function. The only issue is I needed that pokeName variable from the GET fetch request to compare it to my guess. I expanded the scope of pokeName by creating it outside the function and changing its contents within the function. I used many debugging tools to come up with this solution. I used console.log(), the Node.js debugger, and Google!&lt;/p&gt;

&lt;p&gt;I was very proud of this project because I think it really shows off everything I have learned in the past two months. While I felt comfortable writing some JavaScript before, I know feel like I know exactly what my code is doing under the hood. This allows me to write my code faster and problem solve easier. My code looks like something I can read and immediately know what is happening, instead of a bunch of random letters and numbers on a screen.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
