[Sparta Coding Club] Week 2 - Today I learned
Tags: webdev, javascript, css, html
Published: 2024-02-17 17:09:53

Today marks the end of my second week at Sparta Coding Club, and what an exciting journey it has been! 

# Key Concepts Learned Today
In this week's sessions, we delved into some fascinating concepts that have expanded my understanding of coding. From exploring the fundamentals of programming, diving into JavaScript syntax, and understanding jQuery, to grasping server-client communication, each lesson has added valuable layers to my coding knowledge.

## 01. Programming is…
- Programming is the process of creating a set of instructions that tell a computer how to perform a task to solve a problem!
- It's like talking to an alien👽 in its language. They can only understand the exact instructions written in codes based on certain rules.
- How is it different from a casual conversation that we have every day? [Check this clip out!]

## 02. Javascript Basic Syntax
- 
1. Variables:
   - Variables are containers for storing data values.
   - They are like labels that you can assign to values or expressions.
   - In JavaScript, you declare a variable using the `var`, `let`, or `const` keywords.

2. Lists:
   - Lists, also known as arrays, are a collection of items.
   - Items in a list can be of different data types (numbers, strings, objects, etc.).
   - Elements in a list are indexed starting from 0, making it easy to access and manipulate specific items.

3. Objects:
   - Objects are complex data types that store key-value pairs.
   - Each key is a string, and the associated value can be any data type, including numbers, strings, arrays, or even other objects.
   - Objects are useful for representing real-world entities and their properties.

4. Functions:
   - Functions are blocks of reusable code designed to perform a specific task.
   - They can take parameters as inputs, perform operations, and return a value.
   - Functions help in organizing code, promoting modularity, and avoiding code duplication.

5. If Statements:
   - If statements are used for conditional execution in a program.
   - They evaluate a condition and execute a block of code if the condition is true.
   - If statements often include optional else and else if clauses for handling additional conditions.

6. For Loops:
   - 'For' loops are used for iterating over a sequence (such as a list or range of numbers).
   - They consist of an initialization, a condition, and an iteration statement.
   - For loops automate the process of repeatedly executing a block of code until a specified condition is met.

These concepts form the building blocks of programming and are fundamental for any developer working with JavaScript or similar programming languages.


## 03. jQuery
- What is jQuery?
  - jQuery is a mature Javascript "library" that helps frontend developers easily modify elements in HTML
    - Even though you could use pure Javascript to change fonts, font colors, and so on...
      1) The code would be complicated
      2) There might be compatibility issues on some browsers (remember, each browser vendor implements Javascript differently!)
    - jQuery vs Javascript
      - jQuery is not a separate software from Javascript. It is a collection of Javascript functions and modules made by the community in advance. You simply attain import in the jQuery library, and suddenly you have access to large amounts of well-crafted code written by specialized programmers, designed to make your life easier.

## 04. Understand server-client communication
- Server→Client: Understanding "JSON"
  - JSON stands for JavaScript Object Notation, which is a syntax for storing and exchanging data.
  
- API: An API is like a bank counter!
  - Even at the same deposit window, depending on whether you are an individual customer or a corporate customer, there is a difference between what needs to be brought and what needs to be processed.
  - There are different ways in which the client can request the server.
    - GET: used to request data from a specified resource. ex) Inquiring movie list 
    - POST: used to send data to a server to create/update/delete a resource. ex) User sign-up, withdrawal of membership, changing passwords
  - Today we're going to learn about the GET request. (POST will be dealt with in week-04)

- AJAX: Remember! Ajax will work only on a page where jQuery has been imported.
  - In other words, if you open the DevTools on a page such as [https://www.google.com/](https://www.google.com/), type in the code directly above into the Javascript console, and press Enter, the following error appears because jQuery is not imported.
  - Uncaught TypeError: $.ajax is not a function → This means that the ajax function is not available for you to use.

My Assignment (Page Screenshot or Video Capture)
As part of our homework assignment this week, we were tasked with creating a webpage that incorporated the concepts learned. Here's a screenshot of my accomplishment:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/twquab5pb3lxdumkm4tn.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rj5zudci56r9ipuujpcc.png)



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t6w76p038mmwxcyvwl6g.png)


This exercise not only reinforced the concepts covered in the sessions but also allowed for creative expression in designing a webpage from scratch.

In conclusion, my second week at Sparta Coding Club has been an enlightening experience, filled with learning, challenges, and a sense of community. I look forward to the weeks ahead, where I will continue to grow as a coder and contribute to the vibrant coding culture at Sparta.

Happy coding!