Lol
I finally succeed to make a code that could show a line of a live currency exchange rate between the lines.

드뎌 환율 실시간으로 보여주는 코드를 만드는데 성공했다.

이틀동안 이거 알아낼라고 머리싸매고 다음주차로 못넘어감 주륵. 평소에 참을성 0이라 그냥 힌트 보고 마는데 이번에는 내 힘으로 해보았다. 물논, 코딩에서 내가 쥐어짜내서 코드를 만들면 그으거는,, 말도안되지, 그냥 구글을 잘해내서 알아냈다^^

I was tempted to cheat cause my code seemed not work for two days, and I really wanted to go to the next chapter for the further study. I usually have no patience, but this time the other side of me won, who wanted to figure things out by myself. When if comes to coding, ‘figure it yourself’ should not indicates that you have to write your own code by yourself. Because simply, that’s not going to happen. Rather, it means you have to find the right ways to get to the destination by asking and mostly, googling.

슬랙에 튜터님들도 있고 현업자분들도 있고 이미 나랑 같은 문제 겪은 사람 오백만명이었지만 내가 알아내고 하는 편이 더 잼쓰니까~!

This time I had many coaches from the SpartaCodingClub, and there were few codes already existed on the Slack but I avoided to get to the correct answer right away, and tried to google and watch the lectures over and over to find the code and the ways to get closer to the right answer.

What confused me most was that I had to make ‘q1’ works without clicking it.
When the tutor explained the assignment, he gave us a hint and it was a

뭐가 날 가장 혼란스럽게 했냐며는 function q1이 클릭 안해도 늘 돌아가고있어야했는데, 코드는 아래와같다.

$(document).ready(function () {
q1();
});

jvscript which makes ‘q1’ to function as soon as the page loaded. But where and how can I put ‘q1’, because unlike the other quiz this did not had any buttons to click on.

그 전 과제에는 보통 이 기능을 어떤 버튼에다가 심어서 눌르면, 또는 안눌러도 실행되게했었는데 이번 과제는 이걸 넣을 버튼이 없어…! 두둥

My solution was to put a simple id on a<h></h> line and give it a ‘show’. At first I used ‘onclick = “q1” but I found ‘show’ would work just fine and it makes more sense at least to me. ‘rate’ was used to give a line a color.

그래서 그냥 <h></h>로 해결했다. 쌈박쌈박^^

.rate {
color: darkgreen;
}
// ----$('#apple').append(temp_html)// ----<div>
<h6 id="apple" class="rate" show ="q1"> </h6>
</div>

This is where I spent most time.
바로 에이젝스 내 시간 다 빨아먹은 !

function q1() {
$.ajax({
type: "GET",
url: "http://spartacodingclub.shop/sparta_api/rate",
data: {},
success: function (response) {
let txt = response['rate']
let temp_html = `<h6> 달러·원 환율: ${txt}</h6>`

$('#apple').append(temp_html)
}
})
}

These are ajax lines. You know what the last word I added on this code was ‘response’ RESPONSE!!!. I seriously was so depressed cause I thought I made everything correctly and it still did not work. So I brought another ajax code from my previous projects to see if I missed anything. Yeah.. I wrote let txt = [‘rate’] instead of let txt = response[‘rate’]. Can you believe this? lol well, I was just too happy to complain, because I’ve waited too long.

마지막에 절망 그 자체였을때 나는 모든것을 다 썻는데 왜 안나오느냐… 하고 그 전 프로젝트들을 다 열어서 봤다. 그렇다. let txt = response[‘rate’] 대신 let txt = [‘rate’] 쓴 것이다… 코드는 점하나의 오류도 용납허지 않기 때문에 이정도의 실수는 너무 큰 실수이다. 인간이 콤퓨타에게 말을 걸기 위해선 정말 너무 꼼꼼해야한다.

During the Second week of the SpartaCodingClub, I learned how JQuery works, how Ajax works. I used both of them by making a webpage functioning differently by clicking the button, or reloaded the page.

2주차 스팔타 코딩 클럽동안, JQuery를 쓰는 법, Ajax를 작동시키는 법을 배웠는데, 버튼 클릭으로 구동하는 법, 페이지를 리로딩 시키면서 작동시키는 법을 배웠다.

While I am moving on, I want to make sure how to use console.log properly so that I could avoid possible bugs.

계속해서 강좌를 진행하겠지만, console.log 쓰는 법이 아직 너무 헷갈린다. 최대한 많이 사용해보아야 발생할 수 있는 오류를 잡을 수 있다는데, 좀 익숙해지는 시간을 가져야겠다.

Wow coding is quite fun. I wish there will be a day when I look back and say
“ I was that silly?” Anyways, I will be back on Week 3, or sooner or later lol. See you future me.

코딩이 생각보다 재미있다. 미래의 나는 이 때의 나를 보며 이렇게 멍청했었다곳…! 할수있는 날이 오길. 암튼 난 이제 3주차에 들어간다! 뿅

--

--