외국계 OTA에서 약 5년간 일한 끝에 프론트엔드 개발자로 전직하겠다는 확실한 목표와 꿈이 생겼고, 이를 위해 스파르타코딩클럽에서 웹개발 종합반을 수강하게 되었다.

1주차 수강 내용:

  • HTML
  • CSS
  • Javascript

1. HTML은 뼈대, CSS는 꾸미기!

  • HTML은 구역과 텍스트를 나타내는 코드로, CSS는 잡은 구역을 꾸며주는 것으로 생각합니다. HTML 내 style 속성으로 꾸미기를 할 수 있지만, 긴 세월동안 이것을 한데 모아 볼 수 있는 CSS 파일이 탄생하게 되었습니다. HTML 코드 내에 CSS 파일을 불러와서 적용합니다.
  • HTML은 크게 head와 body로 구성되며, head안에는 페이지의 속성 정보를, body안에는 페이지의 내용을 담습니다.
  • head 안에 들어가는 대표적인 요소들: meta, script, link, title 등
  • HTML기초
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>스파르타코딩클럽 | HTML 기초</title>
</head>

<body>
    <!-- 구역을 나누는 태그들 -->
    <div>나는 구역을 나누죠</div>
    <p>나는 문단이에요</p>
    <ul>
        <li> bullet point!1 </li>
        <li> bullet point!2 </li>
    </ul>

    <!-- 구역 내 콘텐츠 태그들 -->
    <h1>h1은 제목을 나타내는 태그입니다. 페이지마다 하나씩 꼭 써주는 게 좋아요. 그래야 구글 검색이 잘 되거든요.</h1>
    <h2>h2는 소제목입니다.</h2>
    <h3>h3~h6도 각자의 역할이 있죠. 비중은 작지만..</h3>
    <hr>
    span 태그입니다: 특정 <span style="color:red">글자</span>를 꾸밀 때 써요
    <hr>
    a 태그입니다: <a href="http://naver.com/"> 하이퍼링크 </a>
    <hr>
    img 태그입니다: <img src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png" />
    <hr>
    input 태그입니다: <input type="text" />
    <hr>
    button 태그입니다: <button> 버튼입니다</button>
    <hr>
    textarea 태그입니다: <textarea>나는 무엇일까요?</textarea>
</body>

</html>
  • 간단한 로그인 페이지 만들기
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>로그인페이지</title>
</head>
<body>
    <h1>로그인 페이지</h1>
    <p>ID: <input type="text"/></p>
    <p>PW: <input type="text"/></p>
    <button>로그인하기</button>
</body>
</html>

2. CSS 기초

  • <head> ~ </head> 안에 <style> ~ </style> 로 공간을 만들어 작성합니다.

  • mytitle라는 클래스를 가리킬 때, .mytitle { ... } 라고 써줘야 하는 것을 꼭! 기억하세요!

  • CSS는 어떻게 사용하나요?

    배경관련
    background-color
    background-image
    background-size

    사이즈
    width
    height

    폰트
    font-size
    font-weight
    font-famliy
    color

    간격
    margin
    padding

  • 자주 쓰이는 CSS 연습
    h1, h5, background-image, background-size, background-position
    color, width, height, border-radius, margin, padding

  • margin과 padding ( → 헷갈리지 말기!)
    margin은 바깥 여백을, padding은 내 안쪽 여백을
    div에 색깔을 넣고, 직접 사용해서 차이를 비교해보세요!

  • 이미지URL

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>스파르타코딩클럽 | 로그인페이지</title>
    <style>
        .mytitle {
            color: white;
            width: 300px;
            height: 200px;
            background-image: url('https://www.ancient-origins.net/sites/default/files/field/image/Agesilaus-II-cover.jpg');
            background-position: center;
            background-size: cover;
            
            border-radius: 10px;
            text-align: center;
            padding-top: 40px;
        }
    </style>
</head>

<body>
    <div class="mytitle">
        <h1>로그인 페이지</h1>
        <h5>아이디, 비밀번호를 입력해주세요</h5>
    </div>
    <div>
        <p>
            ID: <input type="text" />
        </p>
        <p>
            PW: <input type="password" />
        </p>
    </div>
    <button>로그인하기</button>
</body>
</body>

</html>
  • 만들어둔 로그인 화면을 가운데로 가져오려면?
    width를 주고, margin: auto를 사용하자!
    그래도 안되면? display:block을 추가!

  • 폰트넣기
    구글웹폰트: 검색하여 마음에 드는 것 선택 후 link 태그를 복사해서 ~ 사이에, CSS를 복사해서 사이에 넣습니다.

<!-- HTML에 이 부분을 추가하고 -->
<link href="https://fonts.googleapis.com/css2?family=Nanum+Gothic&display=swap" rel="stylesheet">
/* CSS에 이 부분을 추가하면 완성! */
* {
	font-family: 'Nanum Gothic', sans-serif;
}
  • 주석 넣기
    단축키: 주석처리하고 싶은 라인들을 선택 → ctrl(또는 command) + / (슬래시)
  • 부트스트랩
    부트스트랩이란? 예쁜 CSS를 미리 모아둔 것
  • [코드스니펫] 나홀로메모장뼈대(완성)
      ```jsx
      <!doctype html>
      <html lang="en">
      
      <head>
          <!-- Required meta tags -->
          <meta charset="utf-8">
          <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
      
          <!-- Bootstrap CSS -->
          <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
                integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
      
          <!-- Optional JavaScript -->
          <!-- jQuery first, then Popper.js, then Bootstrap JS -->
          <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
          <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
                  integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
                  crossorigin="anonymous"></script>
          <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
                  integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
                  crossorigin="anonymous"></script>
      
          <title>스파르타코딩클럽 | 부트스트랩 연습하기</title>
      
          <style>
              .wrap {
                  width: 900px;
                  margin: auto;
              }
          </style>
      
      </head>
      
      <body>
          <div class="wrap">
              <div class="jumbotron">
              <h1 class="display-4">Hello, world!</h1>
              <p class="lead">This is a simple hero unit, a simple jumbotron-style component for calling extra attention to
                  featured content or information.</p>
              <hr class="my-4">
              <p>It uses utility classes for typography and spacing to space content out within the larger container.</p>
              <p class="lead">
                  <a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a>
              </p>
          </div>
              <div class="card-columns">
              <div class="card">
                  <img class="card-img-top" src="https://image.theminda.com/data/tg/image/tour/middle/201905/c8aee858ed6e8c34010fe3c4ae9be8a5.jpg" alt="Card image cap">
                  <div class="card-body">
                      <h5 class="card-title">Card title that wraps to a new line</h5>
                      <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional
                          content. This content is a little bit longer.</p>
                  </div>
              </div>
              <div class="card">
                  <img class="card-img-top" src="https://image.theminda.com/data/tg/image/tour/middle/201905/c8aee858ed6e8c34010fe3c4ae9be8a5.jpg" alt="Card image cap">
                  <div class="card-body">
                      <h5 class="card-title">Card title that wraps to a new line</h5>
                      <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional
                          content. This content is a little bit longer.</p>
                  </div>
              </div>
              <div class="card">
                  <img class="card-img-top" src="https://image.theminda.com/data/tg/image/tour/middle/201905/c8aee858ed6e8c34010fe3c4ae9be8a5.jpg" alt="Card image cap">
                  <div class="card-body">
                      <h5 class="card-title">Card title that wraps to a new line</h5>
                      <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional
                          content. This content is a little bit longer.</p>
                  </div>
              </div>
              <div class="card">
                  <img class="card-img-top" src="https://image.theminda.com/data/tg/image/tour/middle/201905/c8aee858ed6e8c34010fe3c4ae9be8a5.jpg" alt="Card image cap">
                  <div class="card-body">
                      <h5 class="card-title">Card title that wraps to a new line</h5>
                      <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional
                          content. This content is a little bit longer.</p>
                  </div>
              </div>
              <div class="card">
                  <img class="card-img-top" src="https://image.theminda.com/data/tg/image/tour/middle/201905/c8aee858ed6e8c34010fe3c4ae9be8a5.jpg" alt="Card image cap">
                  <div class="card-body">
                      <h5 class="card-title">Card title that wraps to a new line</h5>
                      <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional
                          content. This content is a little bit longer.</p>
                  </div>
              </div>
              <div class="card">
                  <img class="card-img-top" src="https://image.theminda.com/data/tg/image/tour/middle/201905/c8aee858ed6e8c34010fe3c4ae9be8a5.jpg" alt="Card image cap">
                  <div class="card-body">
                      <h5 class="card-title">Card title that wraps to a new line</h5>
                      <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional
                          content. This content is a little bit longer.</p>
                  </div>
              </div>
          </div>
          </div>
      </body>
      
      </html>
      ```
  • [코드스니펫] 나홀로메모장틀(완성)
<!doctype html>
<html lang="en">

<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
          integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
            integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
            crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
            integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
            crossorigin="anonymous"></script>

    <title>스파르타코딩클럽 | 부트스트랩 연습하기</title>

    <link href="https://fonts.googleapis.com/css2?family=Jua&display=swap" rel="stylesheet">

    <style>
        * {
            font-family: 'Jua', sans-serif;
        }

        .wrap {
            width: 900px;
            margin: auto;
        }

        .comment {
            color: blue;
            font-weight: bold;
        }
    </style>

</head>

<body>
<div class="wrap">
    <div class="jumbotron">
        <h1 class="display-4">나홀로 링크 메모장!</h1>
        <p class="lead">중요한 링크를 저장해두고, 나중에 볼 수 있는 공간입니다</p>
        <hr class="my-4">
        <p class="lead">
            <a class="btn btn-primary btn-lg" href="#" role="button">포스팅박스 열기</a>
        </p>
    </div>
    <div class="card-columns">
        <div class="card">
            <img class="card-img-top"
                 src="https://image.theminda.com/data/tg/image/tour/middle/201905/c8aee858ed6e8c34010fe3c4ae9be8a5.jpg"
                 alt="Card image cap">
            <div class="card-body">
                <a href="http://naver.com/" class="card-title">여기 기사 제목이 들어가죠</a>
                <p class="card-text">기사의 요약 내용이 들어갑니다. 동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라만세 무궁화 삼천리 화려강산...</p>
                <p class="card-text comment">여기에 코멘트가 들어갑니다.</p>
            </div>
        </div>
        <div class="card">
            <img class="card-img-top"
                 src="https://image.theminda.com/data/tg/image/tour/middle/201905/c8aee858ed6e8c34010fe3c4ae9be8a5.jpg"
                 alt="Card image cap">
            <div class="card-body">
                <a href="http://naver.com/" class="card-title">여기 기사 제목이 들어가죠</a>
                <p class="card-text">기사의 요약 내용이 들어갑니다. 동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라만세 무궁화 삼천리 화려강산...</p>
                <p class="card-text comment">여기에 코멘트가 들어갑니다.</p>
            </div>
        </div>
        <div class="card">
            <img class="card-img-top"
                 src="https://image.theminda.com/data/tg/image/tour/middle/201905/c8aee858ed6e8c34010fe3c4ae9be8a5.jpg"
                 alt="Card image cap">
            <div class="card-body">
                <a href="http://naver.com/" class="card-title">여기 기사 제목이 들어가죠</a>
                <p class="card-text">기사의 요약 내용이 들어갑니다. 동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라만세 무궁화 삼천리 화려강산...</p>
                <p class="card-text comment">여기에 코멘트가 들어갑니다.</p>
            </div>
        </div>
        <div class="card">
            <img class="card-img-top"
                 src="https://image.theminda.com/data/tg/image/tour/middle/201905/c8aee858ed6e8c34010fe3c4ae9be8a5.jpg"
                 alt="Card image cap">
            <div class="card-body">
                <a href="http://naver.com/" class="card-title">여기 기사 제목이 들어가죠</a>
                <p class="card-text">기사의 요약 내용이 들어갑니다. 동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라만세 무궁화 삼천리 화려강산...</p>
                <p class="card-text comment">여기에 코멘트가 들어갑니다.</p>
            </div>
        </div>
        <div class="card">
            <img class="card-img-top"
                 src="https://image.theminda.com/data/tg/image/tour/middle/201905/c8aee858ed6e8c34010fe3c4ae9be8a5.jpg"
                 alt="Card image cap">
            <div class="card-body">
                <a href="http://naver.com/" class="card-title">여기 기사 제목이 들어가죠</a>
                <p class="card-text">기사의 요약 내용이 들어갑니다. 동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라만세 무궁화 삼천리 화려강산...</p>
                <p class="card-text comment">여기에 코멘트가 들어갑니다.</p>
            </div>
        </div>
        <div class="card">
            <img class="card-img-top"
                 src="https://image.theminda.com/data/tg/image/tour/middle/201905/c8aee858ed6e8c34010fe3c4ae9be8a5.jpg"
                 alt="Card image cap">
            <div class="card-body">
                <a href="http://naver.com/" class="card-title">여기 기사 제목이 들어가죠</a>
                <p class="card-text">기사의 요약 내용이 들어갑니다. 동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라만세 무궁화 삼천리 화려강산...</p>
                <p class="card-text comment">여기에 코멘트가 들어갑니다.</p>
            </div>
        </div>
    </div>
</div>
</body>

</html>
  • 나홀로메모장의 포스팅박스를 완성하기
    경계선을 둥글게 그리는 방법
    - border
    - border-radius
    경계선과 내부 요소의 간격은 padding으로 조절

  • [코드스니펫] 포스팅박스까지

<!doctype html>
<html lang="en">

<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
        integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
        integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
        crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
        integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
        crossorigin="anonymous"></script>

    <title>스파르타코딩클럽 | 부트스트랩 연습하기</title>

    <link href="https://fonts.googleapis.com/css2?family=Jua&display=swap" rel="stylesheet">

    <style>
        * {
            font-family: 'Jua', sans-serif;
        }

        .wrap {
            margin: auto;
            width: 900px;
        }

        .comment {
            font-weight: bold;
            color: blue;
        }

        .posting-box {
            margin: 10px auto 30px auto;
            width:500px;

            border: 3px solid black;
            border-radius: 5px;

            padding: 25px;
        }
    </style>
</head>

<body>
    <div class="wrap">
        <div class="jumbotron">
            <h1 class="display-4">나홀로 링크 메모장!</h1>
            <p class="lead">중요한 링크를 저장해두고, 나중에 볼 수 있는 공간입니다</p>
            <hr class="my-4">
            <p class="lead">
                <a class="btn btn-primary btn-lg" href="#" role="button">포스팅박스 열기</a>
            </p>
        </div>
        <div class="posting-box">
            <div class="form-group">
                <label for="exampleInputEmail1">아티클 URL</label>
                <input type="email" class="form-control" aria-describedby="emailHelp"
                    placeholder="">
            </div>
            <div class="form-group">
                <label for="exampleInputPassword1">간단 코멘트</label>
                <input type="password" class="form-control" placeholder="">
            </div>
            <button type="submit" class="btn btn-primary">기사 저장</button>
        </div>
        <div class="card-columns">
            <div class="card">
                <img class="card-img-top"
                    src="https://d2ur7st6jjikze.cloudfront.net/offer_photos/29590/185689_medium_1525763241.jpg?1525763241"
                    alt="Card image cap">
                <div class="card-body">
                    <a href="http://naver.com" class="card-title">여기 기사 제목이 들어가죠</a>
                    <p class="card-text">기사의 요약 내용이 들어갑니다. 동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라만세 무궁화 삼천리 화려강산...</p>
                    <p class="card-text comment">여기에 코멘트가 들어갑니다.</p>
                </div>
            </div>
            <div class="card">
                <img class="card-img-top"
                    src="https://d2ur7st6jjikze.cloudfront.net/offer_photos/29590/185689_medium_1525763241.jpg?1525763241"
                    alt="Card image cap">
                <div class="card-body">
                    <a href="http://naver.com" class="card-title">여기 기사 제목이 들어가죠</a>
                    <p class="card-text">기사의 요약 내용이 들어갑니다. 동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라만세 무궁화 삼천리 화려강산...</p>
                    <p class="card-text comment">여기에 코멘트가 들어갑니다.</p>
                </div>
            </div>
            <div class="card">
                <img class="card-img-top"
                    src="https://d2ur7st6jjikze.cloudfront.net/offer_photos/29590/185689_medium_1525763241.jpg?1525763241"
                    alt="Card image cap">
                <div class="card-body">
                    <a href="http://naver.com" class="card-title">여기 기사 제목이 들어가죠</a>
                    <p class="card-text">기사의 요약 내용이 들어갑니다. 동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라만세 무궁화 삼천리 화려강산...</p>
                    <p class="card-text comment">여기에 코멘트가 들어갑니다.</p>
                </div>
            </div>
            <div class="card">
                <img class="card-img-top"
                    src="https://d2ur7st6jjikze.cloudfront.net/offer_photos/29590/185689_medium_1525763241.jpg?1525763241"
                    alt="Card image cap">
                <div class="card-body">
                    <a href="http://naver.com" class="card-title">여기 기사 제목이 들어가죠</a>
                    <p class="card-text">기사의 요약 내용이 들어갑니다. 동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라만세 무궁화 삼천리 화려강산...</p>
                    <p class="card-text comment">여기에 코멘트가 들어갑니다.</p>
                </div>
            </div>
            <div class="card">
                <img class="card-img-top"
                    src="https://d2ur7st6jjikze.cloudfront.net/offer_photos/29590/185689_medium_1525763241.jpg?1525763241"
                    alt="Card image cap">
                <div class="card-body">
                    <a href="http://naver.com" class="card-title">여기 기사 제목이 들어가죠</a>
                    <p class="card-text">기사의 요약 내용이 들어갑니다. 동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라만세 무궁화 삼천리 화려강산...</p>
                    <p class="card-text comment">여기에 코멘트가 들어갑니다.</p>
                </div>
            </div>
        </div>
    </div>
</body>

</html>

3. Javascript (자바스크립트)

  • 전반부 코드가 없는 분들 - 여기서 시작하세요!
    <!doctype html>
    <html lang="en">
    
    <head>
        <!-- Required meta tags -->
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    
        <!-- Bootstrap CSS -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
            integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
    
        <!-- Optional JavaScript -->
        <!-- jQuery first, then Popper.js, then Bootstrap JS -->
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
            integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
            crossorigin="anonymous"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
            integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
            crossorigin="anonymous"></script>
    
        <title>스파르타코딩클럽 | 부트스트랩 연습하기</title>
    
        <link href="https://fonts.googleapis.com/css2?family=Jua&display=swap" rel="stylesheet">
    
        <style>
            * {
                font-family: 'Jua', sans-serif;
            }
    
            .wrap {
                margin: auto;
                width: 900px;
            }
    
            .comment {
                font-weight: bold;
                color: blue;
            }
    
            .posting-box {
                margin: 10px auto 30px auto;
                width:500px;
    
                border: 3px solid black;
                border-radius: 5px;
    
                padding: 25px;
            }
        </style>
    </head>
    
    <body>
        <div class="wrap">
            <div class="jumbotron">
                <h1 class="display-4">나홀로 링크 메모장!</h1>
                <p class="lead">중요한 링크를 저장해두고, 나중에 볼 수 있는 공간입니다</p>
                <hr class="my-4">
                <p class="lead">
                    <a class="btn btn-primary btn-lg" href="#" role="button">포스팅박스 열기</a>
                </p>
            </div>
            <div class="posting-box">
                <div class="form-group">
                    <label for="exampleInputEmail1">아티클 URL</label>
                    <input type="email" class="form-control" aria-describedby="emailHelp"
                        placeholder="">
                </div>
                <div class="form-group">
                    <label for="exampleInputPassword1">간단 코멘트</label>
                    <input type="password" class="form-control" placeholder="">
                </div>
                <button type="submit" class="btn btn-primary">기사 저장</button>
            </div>
            <div class="card-columns">
                <div class="card">
                    <img class="card-img-top"
                        src="https://d2ur7st6jjikze.cloudfront.net/offer_photos/29590/185689_medium_1525763241.jpg?1525763241"
                        alt="Card image cap">
                    <div class="card-body">
                        <a href="http://naver.com" class="card-title">여기 기사 제목이 들어가죠</a>
                        <p class="card-text">기사의 요약 내용이 들어갑니다. 동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라만세 무궁화 삼천리 화려강산...</p>
                        <p class="card-text comment">여기에 코멘트가 들어갑니다.</p>
                    </div>
                </div>
                <div class="card">
                    <img class="card-img-top"
                        src="https://d2ur7st6jjikze.cloudfront.net/offer_photos/29590/185689_medium_1525763241.jpg?1525763241"
                        alt="Card image cap">
                    <div class="card-body">
                        <a href="http://naver.com" class="card-title">여기 기사 제목이 들어가죠</a>
                        <p class="card-text">기사의 요약 내용이 들어갑니다. 동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라만세 무궁화 삼천리 화려강산...</p>
                        <p class="card-text comment">여기에 코멘트가 들어갑니다.</p>
                    </div>
                </div>
                <div class="card">
                    <img class="card-img-top"
                        src="https://d2ur7st6jjikze.cloudfront.net/offer_photos/29590/185689_medium_1525763241.jpg?1525763241"
                        alt="Card image cap">
                    <div class="card-body">
                        <a href="http://naver.com" class="card-title">여기 기사 제목이 들어가죠</a>
                        <p class="card-text">기사의 요약 내용이 들어갑니다. 동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라만세 무궁화 삼천리 화려강산...</p>
                        <p class="card-text comment">여기에 코멘트가 들어갑니다.</p>
                    </div>
                </div>
                <div class="card">
                    <img class="card-img-top"
                        src="https://d2ur7st6jjikze.cloudfront.net/offer_photos/29590/185689_medium_1525763241.jpg?1525763241"
                        alt="Card image cap">
                    <div class="card-body">
                        <a href="http://naver.com" class="card-title">여기 기사 제목이 들어가죠</a>
                        <p class="card-text">기사의 요약 내용이 들어갑니다. 동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라만세 무궁화 삼천리 화려강산...</p>
                        <p class="card-text comment">여기에 코멘트가 들어갑니다.</p>
                    </div>
                </div>
                <div class="card">
                    <img class="card-img-top"
                        src="https://d2ur7st6jjikze.cloudfront.net/offer_photos/29590/185689_medium_1525763241.jpg?1525763241"
                        alt="Card image cap">
                    <div class="card-body">
                        <a href="http://naver.com" class="card-title">여기 기사 제목이 들어가죠</a>
                        <p class="card-text">기사의 요약 내용이 들어갑니다. 동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라만세 무궁화 삼천리 화려강산...</p>
                        <p class="card-text comment">여기에 코멘트가 들어갑니다.</p>
                    </div>
                </div>
            </div>
        </div>
    </body>
    
    </html>
  • 함수를 만들어두기
    function hey(){
    	alert('안녕!');
    }
    👉 ~ 안에 로 공간을 만들어 작성합니다. 내에 자바스크립트를 작성하는 것이죠 아래 코드를 통해 간단한 사용방법을 알아봅니다. https://s3-us-west-2.amazonaws.com/secure.notion-static.com/9f115847-3c27-4b00-98bc-26528d299d0c/Untitled.png](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/9f115847-3c27-4b00-98bc-26528d299d0c/Untitled.png
  • 완성본
    <!doctype html>
    <html lang="en">
    
    <head>
        <!-- Required meta tags -->
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    
        <!-- Bootstrap CSS -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
            integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
    
        <!-- Optional JavaScript -->
        <!-- jQuery first, then Popper.js, then Bootstrap JS -->
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
            integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
            crossorigin="anonymous"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
            integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
            crossorigin="anonymous"></script>
    
        <title>스파르타코딩클럽 | 부트스트랩 연습하기</title>
    
        <link href="https://fonts.googleapis.com/css2?family=Jua&display=swap" rel="stylesheet">
    
        <style>
            * {
                font-family: 'Jua', sans-serif;
            }
    
            .wrap {
                margin: auto;
                width: 900px;
            }
    
            .comment {
                font-weight: bold;
                color: blue;
            }
    
            .posting-box {
                margin: 10px auto 30px auto;
                width:500px;
    
                border: 3px solid black;
                border-radius: 5px;
    
                padding: 25px;
            }
        </style>
    		<script>
    				function hey(){
    					alert('안녕!');
    				}
    		</script>
    </head>
    
    <body>
        <div class="wrap">
            <div class="jumbotron">
                <h1 class="display-4">나홀로 링크 메모장!</h1>
                <p class="lead">중요한 링크를 저장해두고, 나중에 볼 수 있는 공간입니다</p>
                <hr class="my-4">
                <p class="lead">
                    <a onclick="hey()" class="btn btn-primary btn-lg" href="#" role="button">포스팅박스 열기</a>
                </p>
            </div>
            <div class="posting-box">
                <div class="form-group">
                    <label for="exampleInputEmail1">아티클 URL</label>
                    <input type="email" class="form-control" aria-describedby="emailHelp"
                        placeholder="">
                </div>
                <div class="form-group">
                    <label for="exampleInputPassword1">간단 코멘트</label>
                    <input type="password" class="form-control" placeholder="">
                </div>
                <button type="submit" class="btn btn-primary">기사 저장</button>
            </div>
            <div class="card-columns">
                <div class="card">
                    <img class="card-img-top"
                        src="https://d2ur7st6jjikze.cloudfront.net/offer_photos/29590/185689_medium_1525763241.jpg?1525763241"
                        alt="Card image cap">
                    <div class="card-body">
                        <a href="http://naver.com" class="card-title">여기 기사 제목이 들어가죠</a>
                        <p class="card-text">기사의 요약 내용이 들어갑니다. 동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라만세 무궁화 삼천리 화려강산...</p>
                        <p class="card-text comment">여기에 코멘트가 들어갑니다.</p>
                    </div>
                </div>
                <div class="card">
                    <img class="card-img-top"
                        src="https://d2ur7st6jjikze.cloudfront.net/offer_photos/29590/185689_medium_1525763241.jpg?1525763241"
                        alt="Card image cap">
                    <div class="card-body">
                        <a href="http://naver.com" class="card-title">여기 기사 제목이 들어가죠</a>
                        <p class="card-text">기사의 요약 내용이 들어갑니다. 동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라만세 무궁화 삼천리 화려강산...</p>
                        <p class="card-text comment">여기에 코멘트가 들어갑니다.</p>
                    </div>
                </div>
                <div class="card">
                    <img class="card-img-top"
                        src="https://d2ur7st6jjikze.cloudfront.net/offer_photos/29590/185689_medium_1525763241.jpg?1525763241"
                        alt="Card image cap">
                    <div class="card-body">
                        <a href="http://naver.com" class="card-title">여기 기사 제목이 들어가죠</a>
                        <p class="card-text">기사의 요약 내용이 들어갑니다. 동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라만세 무궁화 삼천리 화려강산...</p>
                        <p class="card-text comment">여기에 코멘트가 들어갑니다.</p>
                    </div>
                </div>
                <div class="card">
                    <img class="card-img-top"
                        src="https://d2ur7st6jjikze.cloudfront.net/offer_photos/29590/185689_medium_1525763241.jpg?1525763241"
                        alt="Card image cap">
                    <div class="card-body">
                        <a href="http://naver.com" class="card-title">여기 기사 제목이 들어가죠</a>
                        <p class="card-text">기사의 요약 내용이 들어갑니다. 동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라만세 무궁화 삼천리 화려강산...</p>
                        <p class="card-text comment">여기에 코멘트가 들어갑니다.</p>
                    </div>
                </div>
                <div class="card">
                    <img class="card-img-top"
                        src="https://d2ur7st6jjikze.cloudfront.net/offer_photos/29590/185689_medium_1525763241.jpg?1525763241"
                        alt="Card image cap">
                    <div class="card-body">
                        <a href="http://naver.com" class="card-title">여기 기사 제목이 들어가죠</a>
                        <p class="card-text">기사의 요약 내용이 들어갑니다. 동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라만세 무궁화 삼천리 화려강산...</p>
                        <p class="card-text comment">여기에 코멘트가 들어갑니다.</p>
                    </div>
                </div>
            </div>
        </div>
    </body>
    
    </html>
  • Javascript 기초 문법 (1)
    console.log(변수) 는, 콘솔 창에 괄호 안의 값을 출력해줍니다.
    개발자가 결과값을 보기 편하도록!
    console.log(변수1,변수2) 로 여러 변수를 한번에 출력할 수도 있어요.
    console.log("Hello World!");
  • 변수 & 기본연산
    변수 대입( a = 2 )의 의미: "오른쪽에 있는 것을 왼쪽에 넣는 것!"
    (2를 a라는 변수에 넣는다)
    let으로 변수를 선언합니다.
    ```jsx
    let num = 20
    num = 'Bob'
    
    // 변수는 값을 저장하는 박스예요.
    // 한 번 선언했으면, 다시 선언하지 않고 값을 넣습니다.
    ```

사칙연산, 그리고 문자열 더하기가 기본적으로 가능합니다.

```jsx
let a = 1
let b = 2

a+b // 3
a/b // 0.5

let first = 'Bob'
let last = 'Lee'

first+last // 'BobLee'

first+' '+last // 'Bob Lee'

first+a // Bob1 -> 문자+숫자를 하면, 숫자를 문자로 바꾼 뒤 수행합니다.
```

변수명은 아무렇게나?

```jsx
let first_name = 'bob' // snake case라고 합니다.

또는,

let firstName = 'bob' // camel case라고 합니다. 회사마다 규칙이 있죠.

과 같이, 쉽게 알아볼 수 있게 쓰는 게 중요합니다.
다른 특수문자 또는 띄워쓰기는 불가능합니다!
```

Snake case : xxx_xxx_xxx
Camel case : xxxXxxXxx
Capitalcase : XxxXxxXxx

  • 리스트 & 딕셔너리
    리스트: 순서를 지켜서 가지고 있는 형태입니다.

    let a_list = []  // 리스트를 선언. 변수 이름은 역시 아무렇게나 가능!
    
    // 또는,
    
    let b_list = [1,2,'hey',3] // 로 선언 가능
    
    b_list[1] // 2 를 출력
    b_list[2] // 'hey'를 출력
    
    // 리스트에 요소 넣기
    b_list.push('헤이')
    b_list // [1, 2, "hey", 3, "헤이"] 를 출력
    
    // 리스트의 길이 구하기
    b_list.length // 5를 출력

    딕셔너리: 키(key)-밸류(value) 값의 묶음

    let a_dict = {}  // 딕셔너리 선언. 변수 이름은 역시 아무렇게나 가능!
    
    // 또는,
    
    let b_dict = {'name':'Bob','age':21} // 로 선언 가능
    b_dict['name'] // 'Bob'을 출력
    b_dict['age'] // 21을 출력
    
    b_dict['height'] = 180 // 딕셔너리에 키:밸류 넣기
    b_dict // {name: "Bob", age: 21, height: 180}을 출력

    리스트와 딕셔너리의 조합

    names = [{'name':'bob','age':20},{'name':'carry','age':38}]
    
    // names[0]['name']의 값은? 'bob'
    // names[1]['name']의 값은? 'carry'
    
    new_name = {'name':'john','age':7}
    names.push(new_name)
    
    // names의 값은? [{'name':'bob','age':20},{'name':'carry','age':38},{'name':'john','age':7}]
    // names[2]['name']의 값은? 'john'

    왜 필요할까요?
    💡 순서를 표시할 수 있고, 정보를 묶을 수 있습니다.

    앞에서 언급한 <스파르타과일가게>가 정말 잘 되어서 전국에서 손님이 찾아오고 있습니다. 대기표를 작성하기 위해서 온 순서대로 이름, 휴대폰 번호를 적도록 하였는데요. 변수만을 사용한 모습은 다음과 같습니다.

    let customer_1_name = '김스파';
    let customer_1_phone = '010-1234-1234';
    let customer_2_name = '박르탄';
    let customer_2_phone = '010-4321-4321';
    ...(알아보기 힘듭니다.)

    👉딕셔너리를 활용한다면 다음과 같이 고객 별로 정보를 묶을 수 있습니다.
    let customer_1 = {'name': '김스파', 'phone': '010-1234-1234'};
    let customer_2 = {'name': '박르탄', 'phone': '010-4321-4321'};

    👉그리고 순서를 나타내기 위해 리스트를 사용하면, 이렇게나 깔끔해집니다.
    let customer = [
    {'name': '김스파', 'phone': '010-1234-1234'},
    {'name': '박르탄', 'phone': '010-4321-4321'}
    ]

    ✅보기에도 깔끔해지고, 다루기도 쉬워지고, 고객이 새로 한 명 더 오더라도 .push 함수를 이용해 간단하게 대응할 수 있습니다.

    기본 함수들
    사칙연산 외에도, 기본적으로 제공하는 여러 함수들이 존재합니다.

       <aside>
       👉 왠지 이건 있을 것 같은데?(예 - 특정 문자를 바꾸고 싶다 등) 싶으면 직접 만들지 말고 **구글에 먼저 찾아보세요!**
       
       </aside>
       
       ```jsx
       **예를 들면, '나눗셈의나머지'를 구하고 싶은 경우**
       
       let a = 20
       let b = 7
       
       a % b = 6
       ```
       
       ```jsx
       **또, 모든 알파벳을 대문자로 바꾸고 싶은 경우**
       
       let myname = 'spartacodingclub'
       
       myname.toUpperCase() // SPARTACODINGCLUB
       ```
       
       ```jsx
       **또, 특정 문자로 문자열을 나누고 싶은 경우**
       
       let myemail = 'sparta@gmail.com'
       
       let result = myemail.split('@') // ['sparta','gmail.com']
       
       result[0] // sparta
       result[1] // gmail.com
       
       let result2 = result[1].split('.') // ['gmail','com']
       
       result2[0] // gmail -> 우리가 알고 싶었던 것!
       result2[1] // com
       
       myemail.split('@')[1].split('.')[0] // gmail -> 간단하게 쓸 수도 있다!
       ```
       
       ```jsx
       **특정 문자로 나누고 싶은 경우 2**
       
       let txt = '서울시-마포구-망원동'
       
       ****let names = txt.split('-'); // ['서울시','마포구','망원동']
       
       **특정 문자로 합치고 싶은 경우**
       
       let result = names.join('>'); // '서울시>마포구>망원동' (즉, 문자열 바꾸기!)
       ```
  • Javascript 기초 문법 배우기(2)
    함수
    - 기본 생김새

        ```jsx
        // 만들기
        function 함수이름(필요한 변수들) {
        	내릴 명령들을 순차적으로 작성
        }
        // 사용하기
        함수이름(필요한 변수들);
        ```
        
    - 예시
        
        ```jsx
        // 두 숫자를 입력받으면 더한 결과를 돌려주는 함수
        function sum(num1, num2) {
        	console.log('num1: ', num1, ', num2: ', num2);
        	return num1 + num2;
        }
        
        sum(3, 5); // 8
        sum(4, -1); // 3
        ```
        

    조건문
    - 20 보다 작으면 작다고, 크면 크다고 알려주는 함수

        ```jsx
        function is_adult(age){
        	if(age > 20){
        		alert('성인이에요')
        	} else {
        		alert('청소년이에요')
        	}
        }
        
        is_adult(25)
        ```
        
    - if, else if, else if, else if else
        
        ```jsx
        function is_adult(age){
        	if(age > 20){
        		alert('성인이에요')
        	} else if (age > 10) {
        		alert('청소년이에요')
        	} else {
        		alert('10살 이하!')
        	}
        }
        
        is_adult(12)
        ```
        
    - AND 조건과 OR 조건!
        
        ```jsx
        // AND 조건은 이렇게
        function is_adult(age, sex){
        	if(age > 20 && sex == '여'){
        		alert('성인 여성')
        	} else if (age > 20 && sex == '남') {
        		alert('성인 남성')
        	} else {
        		alert('청소년이에요')
        	}
        }
        
        // 참고: OR 조건은 이렇게
        function is_adult(age, sex){
        	if (age > 65 || age < 10) {
        		alert('탑승하실 수 없습니다')
        	} else if(age > 20 && sex == '여'){
        		alert('성인 여성')
        	} else if (age > 20 && sex == '남') {
        		alert('성인 남성')
        	} else {
        		alert('청소년이에요')
        	}
        }
        
        is_adult(25,'남')
        ```
        

    반복문
    - 예를 들어 0부터 99까지 출력해야 하는 상황이라면!

        ```jsx
        console.log(0)
        console.log(1)
        console.log(2)
        console.log(3)
        console.log(4)
        console.log(5)
        ...
        console.log(99)
        
        // 이렇게 쓰기엔 무리가 있겠죠? 그래서, 반복문이라는 것이 존재합니다!
        ```
        
    - 반복문을 이용하면 아래와 같이 단 세줄로, 출력할 수 있습니다.
        
        ```jsx
        for (let i = 0; i < 100; i++) {
        	console.log(i);
        }
        ```
        
        ```jsx
        for (1. 시작조건; 2. 반복조건; 3. 더하기) {
        	4. 매번실행
        }
        
        1 -> 2체크하고 -> (괜찮으면) -> 4 -> 3
        -> 2체크하고 -> (괜찮으면) -> 4 -> 3
        -> 2체크하고 -> (괜찮으면) -> 4 -> 3
        -> 2체크하고 -> (괜찮으면) -> 4 -> 3
        
        와 같은 순서로 실행됩니다.
        i가 증가하다가 반복조건에 맞지 않으면, 반복을 종료하고 빠져나옵니다.
        ```
        
    - 그러나 위처럼 숫자를 출력하는 경우보다는, 반복문은 주로 리스트와 함께 쓰입니다.
    아래 예시를 볼까요? 일단 아래를 복사 붙여넣기 하고, 함께 코딩해볼게요
        - **[코드스니펫] 반복문 예제1**
            
            ```jsx
            let people = ['철수','영희','민수','형준','기남','동희']
            ```
            
        
        ```jsx
        let people = ['철수','영희','민수','형준','기남','동희']
        
        // 이렇게 하면 리스트의 모든 원소를 한번에 출력할 수 있겠죠?
        // i가 1씩 증가하면서, people의 원소를 차례대로 불러올 수 있게 됩니다.
        for (let i = 0 ; i < people.length ; i++) {
        	console.log(people[i])
        }
        ```
        
    - 리스트도 그냥 리스트가 아닙니다! 딕셔너리가 들어간 리스트와 찰떡이죠
    다시 아래를 복사 붙여넣기 해볼까요?
        - **[코드스니펫] 반복문 예제2**
            
            ```jsx
            let scores = [
            	{'name':'철수', 'score':90},
            	{'name':'영희', 'score':85},
            	{'name':'민수', 'score':70},
              {'name':'형준', 'score':50},
              {'name':'기남', 'score':68},
              {'name':'동희', 'score':30},
            ]
            ```
            
        
        ```jsx
        let scores = [
        	{'name':'철수', 'score':90},
        	{'name':'영희', 'score':85},
        	{'name':'민수', 'score':70},
          {'name':'형준', 'score':50},
          {'name':'기남', 'score':68},
          {'name':'동희', 'score':30},
        ]
        
        for (let i = 0 ; i < scores.length ; i++) {
        	console.log(scores[i]);
        }
        
        // 이렇게 하면 리스트 내의 딕셔너리를 하나씩 출력할 수 있고,
        ```
        
        ```jsx
        for (let i = 0 ; i < scores.length ; i++) {
        	if (scores[i]['score'] < 70) {
        		console.log(scores[i]['name']);
        	}
        }
        
        // 이렇게 하면 점수가 70점 미만인 사람들의 이름만 출력할 수도 있습니다.
        ```
        

    기타 알아두면 좋은 정보
    []: 가져오기
    {}: 선언
    let a_list = [] 리스트 선언
    let a_dict = {} 딕셔너리 선언
    ==: ‘같다' 의미로 쓸 때는 =두개 씀
    !==: 같지 않다
    .split('나누는 값'): 나누는 값 기준으로 앞 뒤 나눔
    myemail.split(‘@’): hyejin4169@gmail.com -> hyejin4169, gmail.com
    myemail.split(‘@’)[1].split(‘.’): gmail, com
    myemail.split(‘@’)[1].split(‘.’)[0]: gmail
    Shift+enter: console에서 줄바꿈 시
    Return: 끝내고 나를 변신시켜줘
    함수: 정해진 동작을 하는 것. 부르면 정해진 동작을 함

4. Javascript 연습하기

  • 전형적인 패턴 함께 연습하기

    • (1) 미세먼지(IDEX_MVL)의 값이 40 미만인 구 이름(MSRSTE_NM)과 값을 출력하기
      • [코드스니펫] 서울시 미세먼지 값

        ```jsx
        let mise_list = [
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "도심권",
            MSRSTE_NM: "중구",
            PM10: 22,
            PM25: 14,
            O3: 0.018,
            NO2: 0.015,
            CO: 0.4,
            SO2: 0.002,
            IDEX_NM: "좋음",
            IDEX_MVL: 31,
            ARPLT_MAIN: "O3",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "도심권",
            MSRSTE_NM: "종로구",
            PM10: 24,
            PM25: 18,
            O3: 0.013,
            NO2: 0.016,
            CO: 0.4,
            SO2: 0.003,
            IDEX_NM: "좋음",
            IDEX_MVL: 39,
            ARPLT_MAIN: "PM25",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "도심권",
            MSRSTE_NM: "용산구",
            PM10: 0,
            PM25: 15,
            O3: 0.012,
            NO2: 0.027,
            CO: 0.4,
            SO2: 0.003,
            IDEX_NM: "점검중",
            IDEX_MVL: -99,
            ARPLT_MAIN: "점검중",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "서북권",
            MSRSTE_NM: "은평구",
            PM10: 36,
            PM25: 14,
            O3: 0.019,
            NO2: 0.018,
            CO: 0.5,
            SO2: 0.005,
            IDEX_NM: "좋음",
            IDEX_MVL: 42,
            ARPLT_MAIN: "PM10",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "서북권",
            MSRSTE_NM: "서대문구",
            PM10: 28,
            PM25: 9,
            O3: 0.018,
            NO2: 0.015,
            CO: 0.6,
            SO2: 0.004,
            IDEX_NM: "좋음",
            IDEX_MVL: 37,
            ARPLT_MAIN: "PM10",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "서북권",
            MSRSTE_NM: "마포구",
            PM10: 26,
            PM25: 8,
            O3: 0.012,
            NO2: 0.021,
            CO: 0.5,
            SO2: 0.003,
            IDEX_NM: "좋음",
            IDEX_MVL: 36,
            ARPLT_MAIN: "NO2",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "동북권",
            MSRSTE_NM: "광진구",
            PM10: 17,
            PM25: 9,
            O3: 0.018,
            NO2: 0.016,
            CO: 0.6,
            SO2: 0.001,
            IDEX_NM: "좋음",
            IDEX_MVL: 31,
            ARPLT_MAIN: "O3",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "동북권",
            MSRSTE_NM: "성동구",
            PM10: 21,
            PM25: 12,
            O3: 0.018,
            NO2: 0.017,
            CO: 0.4,
            SO2: 0.003,
            IDEX_NM: "좋음",
            IDEX_MVL: 33,
            ARPLT_MAIN: "PM25",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "동북권",
            MSRSTE_NM: "중랑구",
            PM10: 27,
            PM25: 10,
            O3: 0.015,
            NO2: 0.019,
            CO: 0.4,
            SO2: 0.003,
            IDEX_NM: "좋음",
            IDEX_MVL: 34,
            ARPLT_MAIN: "PM10",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "동북권",
            MSRSTE_NM: "동대문구",
            PM10: 26,
            PM25: 9,
            O3: 0.016,
            NO2: 0.017,
            CO: 0.4,
            SO2: 0.003,
            IDEX_NM: "좋음",
            IDEX_MVL: 34,
            ARPLT_MAIN: "PM10",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "동북권",
            MSRSTE_NM: "성북구",
            PM10: 27,
            PM25: 8,
            O3: 0.022,
            NO2: 0.014,
            CO: 0.5,
            SO2: 0.003,
            IDEX_NM: "좋음",
            IDEX_MVL: 37,
            ARPLT_MAIN: "PM10",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "동북권",
            MSRSTE_NM: "도봉구",
            PM10: 25,
            PM25: 12,
            O3: 0.024,
            NO2: 0.011,
            CO: 0.3,
            SO2: 0.002,
            IDEX_NM: "좋음",
            IDEX_MVL: 41,
            ARPLT_MAIN: "O3",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "동북권",
            MSRSTE_NM: "강북구",
            PM10: 30,
            PM25: 15,
            O3: 0.022,
            NO2: 0.02,
            CO: 0.4,
            SO2: 0.002,
            IDEX_NM: "좋음",
            IDEX_MVL: 39,
            ARPLT_MAIN: "PM10",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "동북권",
            MSRSTE_NM: "노원구",
            PM10: 21,
            PM25: 14,
            O3: 0.017,
            NO2: 0.016,
            CO: 0.4,
            SO2: 0.004,
            IDEX_NM: "좋음",
            IDEX_MVL: 36,
            ARPLT_MAIN: "PM25",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "서남권",
            MSRSTE_NM: "강서구",
            PM10: 36,
            PM25: 16,
            O3: 0.021,
            NO2: 0.013,
            CO: 0.4,
            SO2: 0.004,
            IDEX_NM: "좋음",
            IDEX_MVL: 42,
            ARPLT_MAIN: "PM10",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "서남권",
            MSRSTE_NM: "구로구",
            PM10: 23,
            PM25: 10,
            O3: 0.022,
            NO2: 0.016,
            CO: 0.3,
            SO2: 0.003,
            IDEX_NM: "좋음",
            IDEX_MVL: 37,
            ARPLT_MAIN: "O3",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "서남권",
            MSRSTE_NM: "영등포구",
            PM10: 29,
            PM25: 15,
            O3: 0.01,
            NO2: 0.022,
            CO: 0.4,
            SO2: 0.003,
            IDEX_NM: "좋음",
            IDEX_MVL: 41,
            ARPLT_MAIN: "PM10",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "서남권",
            MSRSTE_NM: "동작구",
            PM10: 29,
            PM25: 15,
            O3: 0.012,
            NO2: 0.023,
            CO: 0.4,
            SO2: 0.003,
            IDEX_NM: "좋음",
            IDEX_MVL: 41,
            ARPLT_MAIN: "PM10",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "서남권",
            MSRSTE_NM: "관악구",
            PM10: 27,
            PM25: 12,
            O3: 0.012,
            NO2: 0.022,
            CO: 0.4,
            SO2: 0.003,
            IDEX_NM: "좋음",
            IDEX_MVL: 37,
            ARPLT_MAIN: "NO2",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "서남권",
            MSRSTE_NM: "금천구",
            PM10: 25,
            PM25: 15,
            O3: 0.015,
            NO2: 0.02,
            CO: 0.4,
            SO2: 0.004,
            IDEX_NM: "좋음",
            IDEX_MVL: 43,
            ARPLT_MAIN: "PM25",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "서남권",
            MSRSTE_NM: "양천구",
            PM10: 0,
            PM25: 14,
            O3: 0.016,
            NO2: 0.017,
            CO: 0.4,
            SO2: 0.003,
            IDEX_NM: "점검중",
            IDEX_MVL: -99,
            ARPLT_MAIN: "점검중",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "동남권",
            MSRSTE_NM: "강남구",
            PM10: 31,
            PM25: 16,
            O3: 0.018,
            NO2: 0.018,
            CO: 0.4,
            SO2: 0.003,
            IDEX_NM: "좋음",
            IDEX_MVL: 39,
            ARPLT_MAIN: "PM10",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "동남권",
            MSRSTE_NM: "서초구",
            PM10: 34,
            PM25: 13,
            O3: 0.024,
            NO2: 0.019,
            CO: 0.3,
            SO2: 0.003,
            IDEX_NM: "좋음",
            IDEX_MVL: 41,
            ARPLT_MAIN: "PM10",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "동남권",
            MSRSTE_NM: "송파구",
            PM10: 25,
            PM25: 6,
            O3: 0.014,
            NO2: 0.025,
            CO: 0.4,
            SO2: 0.003,
            IDEX_NM: "좋음",
            IDEX_MVL: 42,
            ARPLT_MAIN: "NO2",
          },
          {
            MSRDT: "201912052100",
            MSRRGN_NM: "동남권",
            MSRSTE_NM: "강동구",
            PM10: 24,
            PM25: 14,
            O3: 0.016,
            NO2: 0.02,
            CO: 0.4,
            SO2: 0.002,
            IDEX_NM: "좋음",
            IDEX_MVL: 39,
            ARPLT_MAIN: "PM25",
          },
        ];
        ```
        for (let i = <0; i < mise_list.length; i++) {
          let mise = mise_list[i];
          if (mise["IDEX_MVL"] < 40) {
            let gu_name = mise["MSRSTE_NM"];
            let gu_mise = mise["IDEX_MVL"];
            console.log("40보다 작은 구: " + gu_name + ", " + gu_mise);
          }
        }

        40 이하든, 35 이하든 유용하게 쓸 수 있게, 함수로 만들어볼까요?

        function show_gus(index) {
          for (let i = 0; i < mise_list.length; i++) {
            let mise = mise_list[i];
            if (mise["IDEX_MVL"] < index) {
              let gu_name = mise["MSRSTE_NM"];
              let gu_mise = mise["IDEX_MVL"];
        	    console.log(index + "보다 작은 구: " + gu_name + ", " + gu_mise);
            }
          }
        }
        
        // 이러면 아래와 같은 것이 가능!
        show_gus(40) // 40보다 작은 구만 출력!
        show_gus(35) // 35보다 작은 구만 출력!
    • (2) 자전거(parkingBikeTotCnt)가 5개 이하인 정류장의 이름을 출력하기
      • [코드스니펫] 서울시 따릉이 현황

        ```jsx
        let bikes = [
          {
            rackTotCnt: "7",
            stationName: "101. (구)합정동 주민센터",
            parkingBikeTotCnt: "4",
            shared: "14",
            stationLatitude: "37.54956055",
            stationLongitude: "126.90575409",
            stationId: "ST-3",
          },
          {
            rackTotCnt: "22",
            stationName: "102. 망원역 1번출구 앞",
            parkingBikeTotCnt: "17",
            shared: "5",
            stationLatitude: "37.55564880",
            stationLongitude: "126.91062927",
            stationId: "ST-4",
          },
          {
            rackTotCnt: "16",
            stationName: "103. 망원역 2번출구 앞",
            parkingBikeTotCnt: "11",
            shared: "13",
            stationLatitude: "37.55495071",
            stationLongitude: "126.91083527",
            stationId: "ST-5",
          },
          {
            rackTotCnt: "15",
            stationName: "104. 합정역 1번출구 앞",
            parkingBikeTotCnt: "11",
            shared: "0",
            stationLatitude: "37.55062866",
            stationLongitude: "126.91498566",
            stationId: "ST-6",
          },
          {
            rackTotCnt: "7",
            stationName: "105. 합정역 5번출구 앞",
            parkingBikeTotCnt: "1",
            shared: "0",
            stationLatitude: "37.55000687",
            stationLongitude: "126.91482544",
            stationId: "ST-7",
          },
          {
            rackTotCnt: "12",
            stationName: "106. 합정역 7번출구 앞",
            parkingBikeTotCnt: "8",
            shared: "8",
            stationLatitude: "37.54864502",
            stationLongitude: "126.91282654",
            stationId: "ST-8",
          },
          {
            rackTotCnt: "7",
            stationName: "107. 신한은행 서교동금융센터점 앞",
            parkingBikeTotCnt: "5",
            shared: "14",
            stationLatitude: "37.55751038",
            stationLongitude: "126.91850281",
            stationId: "ST-9",
          },
          {
            rackTotCnt: "12",
            stationName: "108. 서교동 사거리",
            parkingBikeTotCnt: "9",
            shared: "8",
            stationLatitude: "37.55274582",
            stationLongitude: "126.91861725",
            stationId: "ST-10",
          },
          {
            rackTotCnt: "12",
            stationName: "109. 제일빌딩 앞",
            parkingBikeTotCnt: "8",
            shared: "33",
            stationLatitude: "37.54769135",
            stationLongitude: "126.91998291",
            stationId: "ST-11",
          },
          {
            rackTotCnt: "22",
            stationName: "110. 사천교",
            parkingBikeTotCnt: "16",
            shared: "5",
            stationLatitude: "37.56819916",
            stationLongitude: "126.91784668",
            stationId: "ST-13",
          },
          {
            rackTotCnt: "12",
            stationName: "111. 상수역 2번출구 앞",
            parkingBikeTotCnt: "9",
            shared: "25",
            stationLatitude: "37.54787064",
            stationLongitude: "126.92353058",
            stationId: "ST-15",
          },
          {
            rackTotCnt: "12",
            stationName: "112. 극동방송국 앞",
            parkingBikeTotCnt: "8",
            shared: "25",
            stationLatitude: "37.54920197",
            stationLongitude: "126.92320251",
            stationId: "ST-16",
          },
          {
            rackTotCnt: "27",
            stationName: "113. 홍대입구역 2번출구 앞",
            parkingBikeTotCnt: "24",
            shared: "22",
            stationLatitude: "37.55749893",
            stationLongitude: "126.92380524",
            stationId: "ST-18",
          },
          {
            rackTotCnt: "17",
            stationName: "114. 홍대입구역 8번출구 앞",
            parkingBikeTotCnt: "14",
            shared: "129",
            stationLatitude: "37.55706024",
            stationLongitude: "126.92442322",
            stationId: "ST-20",
          },
          {
            rackTotCnt: "17",
            stationName: "115. 사루비아 빌딩 앞",
            parkingBikeTotCnt: "1",
            shared: "0",
            stationLatitude: "37.55893326",
            stationLongitude: "126.92711639",
            stationId: "ST-12",
          },
          {
            rackTotCnt: "7",
            stationName: "116. 일진아이윌아파트 옆",
            parkingBikeTotCnt: "1",
            shared: "0",
            stationLatitude: "37.56454086",
            stationLongitude: "126.92707062",
            stationId: "ST-14",
          },
          {
            rackTotCnt: "27",
            stationName: "117. 홍은사거리",
            parkingBikeTotCnt: "9",
            shared: "0",
            stationLatitude: "37.59115982",
            stationLongitude: "126.94132996",
            stationId: "ST-17",
          },
          {
            rackTotCnt: "12",
            stationName: "118. 광흥창역 2번출구 앞",
            parkingBikeTotCnt: "9",
            shared: "67",
            stationLatitude: "37.54773331",
            stationLongitude: "126.93176270",
            stationId: "ST-19",
          },
          {
            rackTotCnt: "12",
            stationName: "119. 서강나루 공원",
            parkingBikeTotCnt: "9",
            shared: "17",
            stationLatitude: "37.54528427",
            stationLongitude: "126.93105316",
            stationId: "ST-21",
          },
          {
            rackTotCnt: "7",
            stationName: "120. 신수동 사거리",
            parkingBikeTotCnt: "3",
            shared: "0",
            stationLatitude: "37.54524231",
            stationLongitude: "126.93411255",
            stationId: "ST-22",
          },
          {
            rackTotCnt: "17",
            stationName: "121. 마포소방서 앞",
            parkingBikeTotCnt: "11",
            shared: "24",
            stationLatitude: "37.54976654",
            stationLongitude: "126.93317413",
            stationId: "ST-23",
          },
          {
            rackTotCnt: "12",
            stationName: "122. 신성기사식당 앞",
            parkingBikeTotCnt: "6",
            shared: "0",
            stationLatitude: "37.54745865",
            stationLongitude: "126.93837738",
            stationId: "ST-24",
          },
          {
            rackTotCnt: "22",
            stationName: "123. 문화촌 공원",
            parkingBikeTotCnt: "7",
            shared: "0",
            stationLatitude: "37.59432983",
            stationLongitude: "126.94738770",
            stationId: "ST-25",
          },
          {
            rackTotCnt: "22",
            stationName: "124. 서강대 정문 건너편",
            parkingBikeTotCnt: "7",
            shared: "0",
            stationLatitude: "37.55113983",
            stationLongitude: "126.93698883",
            stationId: "ST-26",
          },
          {
            rackTotCnt: "17",
            stationName: "125. 서강대 남문 옆",
            parkingBikeTotCnt: "13",
            shared: "0",
            stationLatitude: "37.54948425",
            stationLongitude: "126.93894958",
            stationId: "ST-27",
          },
          {
            rackTotCnt: "22",
            stationName: "126. 서강대 후문 옆",
            parkingBikeTotCnt: "17",
            shared: "5",
            stationLatitude: "37.55041122",
            stationLongitude: "126.94384766",
            stationId: "ST-28",
          },
          {
            rackTotCnt: "22",
            stationName: "128. 신촌역(2호선) 1번출구 옆",
            parkingBikeTotCnt: "14",
            shared: "5",
            stationLatitude: "37.55549622",
            stationLongitude: "126.93634033",
            stationId: "ST-30",
          },
          {
            rackTotCnt: "17",
            stationName: "129. 신촌역(2호선) 6번출구 옆",
            parkingBikeTotCnt: "8",
            shared: "0",
            stationLatitude: "37.55505371",
            stationLongitude: "126.93756866",
            stationId: "ST-31",
          },
          {
            rackTotCnt: "12",
            stationName: "130. 신촌역(2호선) 7번출구 앞",
            parkingBikeTotCnt: "8",
            shared: "17",
            stationLatitude: "37.55485916",
            stationLongitude: "126.93615723",
            stationId: "ST-32",
          },
          {
            rackTotCnt: "25",
            stationName: "131. 증산2교",
            parkingBikeTotCnt: "17",
            shared: "4",
            stationLatitude: "37.58417130",
            stationLongitude: "126.91110229",
            stationId: "ST-33",
          },
          {
            rackTotCnt: "17",
            stationName: "133. 해담는다리",
            parkingBikeTotCnt: "11",
            shared: "12",
            stationLatitude: "37.58203125",
            stationLongitude: "126.90899658",
            stationId: "ST-35",
          },
          {
            rackTotCnt: "10",
            stationName: "134. 연세로 명물길",
            parkingBikeTotCnt: "6",
            shared: "20",
            stationLatitude: "37.55789185",
            stationLongitude: "126.93807983",
            stationId: "ST-36",
          },
          {
            rackTotCnt: "12",
            stationName: "135. 명물길 원형무대 앞",
            parkingBikeTotCnt: "10",
            shared: "0",
            stationLatitude: "37.55910110",
            stationLongitude: "126.93917847",
            stationId: "ST-37",
          },
          {
            rackTotCnt: "9",
            stationName: "136. 대흥동 주민센터",
            parkingBikeTotCnt: "1",
            shared: "11",
            stationLatitude: "37.55600357",
            stationLongitude: "126.94229889",
            stationId: "ST-38",
          },
          {
            rackTotCnt: "12",
            stationName: "137. NH농협 신촌지점 앞",
            parkingBikeTotCnt: "4",
            shared: "0",
            stationLatitude: "37.55681229",
            stationLongitude: "126.94318390",
            stationId: "ST-39",
          },
          {
            rackTotCnt: "12",
            stationName: "138. 신촌동 제1공영주차장 앞",
            parkingBikeTotCnt: "7",
            shared: "25",
            stationLatitude: "37.55917740",
            stationLongitude: "126.93452454",
            stationId: "ST-40",
          },
          {
            rackTotCnt: "15",
            stationName: "139. 연세대 정문 건너편",
            parkingBikeTotCnt: "13",
            shared: "7",
            stationLatitude: "37.55979538",
            stationLongitude: "126.93447876",
            stationId: "ST-43",
          },
          {
            rackTotCnt: "22",
            stationName: "140. 이화여대 후문",
            parkingBikeTotCnt: "6",
            shared: "0",
            stationLatitude: "37.56000900",
            stationLongitude: "126.94073486",
            stationId: "ST-41",
          },
          {
            rackTotCnt: "22",
            stationName: "141. 연대 대운동장 옆",
            parkingBikeTotCnt: "13",
            shared: "5",
            stationLatitude: "37.56238174",
            stationLongitude: "126.93264771",
            stationId: "ST-42",
          },
          {
            rackTotCnt: "13",
            stationName: "142. 아현역 4번출구 앞",
            parkingBikeTotCnt: "1",
            shared: "0",
            stationLatitude: "37.55720139",
            stationLongitude: "126.95566559",
            stationId: "ST-200",
          },
          {
            rackTotCnt: "11",
            stationName: "143. 공덕역 2번출구",
            parkingBikeTotCnt: "7",
            shared: "0",
            stationLatitude: "37.54457855",
            stationLongitude: "126.95021820",
            stationId: "ST-201",
          },
          {
            rackTotCnt: "12",
            stationName: "144. 공덕역 8번출구",
            parkingBikeTotCnt: "6",
            shared: "0",
            stationLatitude: "37.54357910",
            stationLongitude: "126.95132446",
            stationId: "ST-202",
          },
          {
            rackTotCnt: "11",
            stationName: "145. 공덕역 5번출구",
            parkingBikeTotCnt: "8",
            shared: "36",
            stationLatitude: "37.54425049",
            stationLongitude: "126.95163727",
            stationId: "ST-203",
          },
          {
            rackTotCnt: "14",
            stationName: "146. 마포역 2번출구 뒤",
            parkingBikeTotCnt: "6",
            shared: "0",
            stationLatitude: "37.53993607",
            stationLongitude: "126.94582367",
            stationId: "ST-204",
          },
          {
            rackTotCnt: "9",
            stationName: "147. 마포역 4번출구 뒤",
            parkingBikeTotCnt: "4",
            shared: "0",
            stationLatitude: "37.53927231",
            stationLongitude: "126.94591522",
            stationId: "ST-205",
          },
          {
            rackTotCnt: "17",
            stationName: "150. 서강대역 2번출구 앞",
            parkingBikeTotCnt: "13",
            shared: "65",
            stationLatitude: "37.55295563",
            stationLongitude: "126.93434143",
            stationId: "ST-207",
          },
          {
            rackTotCnt: "12",
            stationName: "151. 망원1동주민센터",
            parkingBikeTotCnt: "11",
            shared: "58",
            stationLatitude: "37.55568695",
            stationLongitude: "126.90554810",
            stationId: "ST-208",
          },
          {
            rackTotCnt: "32",
            stationName: "152. 마포구민체육센터 앞",
            parkingBikeTotCnt: "8",
            shared: "31",
            stationLatitude: "37.55661011",
            stationLongitude: "126.89801788",
            stationId: "ST-209",
          },
          {
            rackTotCnt: "12",
            stationName: "153. 성산2교 사거리",
            parkingBikeTotCnt: "7",
            shared: "17",
            stationLatitude: "37.56469727",
            stationLongitude: "126.91261292",
            stationId: "ST-210",
          },
          {
            rackTotCnt: "15",
            stationName: "154. 마포구청역 ",
            parkingBikeTotCnt: "9",
            shared: "0",
            stationLatitude: "37.56090927",
            stationLongitude: "126.90549469",
            stationId: "ST-211",
          },
          {
            rackTotCnt: "17",
            stationName: "155. 가좌역1 번출구 뒤",
            parkingBikeTotCnt: "14",
            shared: "0",
            stationLatitude: "37.56855011",
            stationLongitude: "126.91451263",
            stationId: "ST-212",
          },
          {
            rackTotCnt: "12",
            stationName: "156. 서울서부지방법원 앞",
            parkingBikeTotCnt: "9",
            shared: "0",
            stationLatitude: "37.54990387",
            stationLongitude: "126.95514679",
            stationId: "ST-213",
          },
          {
            rackTotCnt: "14",
            stationName: "157. 애오개역 4번출구 앞",
            parkingBikeTotCnt: "1",
            shared: "0",
            stationLatitude: "37.55300140",
            stationLongitude: "126.95668793",
            stationId: "ST-214",
          },
          {
            rackTotCnt: "17",
            stationName: "158. 독립문 어린이 공원",
            parkingBikeTotCnt: "1",
            shared: "0",
            stationLatitude: "37.57125854",
            stationLongitude: "126.96047974",
            stationId: "ST-215",
          },
          {
            rackTotCnt: "9",
            stationName: "159. 이대역 4번 출구",
            parkingBikeTotCnt: "1",
            shared: "0",
            stationLatitude: "37.55695343",
            stationLongitude: "126.94634247",
            stationId: "ST-216",
          },
          {
            rackTotCnt: "22",
            stationName: "160. 북아현동 가구거리",
            parkingBikeTotCnt: "15",
            shared: "0",
            stationLatitude: "37.55754852",
            stationLongitude: "126.95938110",
            stationId: "ST-217",
          },
          {
            rackTotCnt: "10",
            stationName: "161. 무악재역1번 출구",
            parkingBikeTotCnt: "0",
            shared: "0",
            stationLatitude: "37.58224487",
            stationLongitude: "126.95064545",
            stationId: "ST-218",
          },
          {
            rackTotCnt: "17",
            stationName: "162. 봉원고가차도 밑",
            parkingBikeTotCnt: "8",
            shared: "0",
            stationLatitude: "37.56526947",
            stationLongitude: "126.94624329",
            stationId: "ST-219",
          },
          {
            rackTotCnt: "9",
            stationName: "163. 명지전문대학교 정문 앞",
            parkingBikeTotCnt: "0",
            shared: "0",
            stationLatitude: "37.58369827",
            stationLongitude: "126.92496490",
            stationId: "ST-220",
          },
          {
            rackTotCnt: "12",
            stationName: "164. 북가좌1동 주민센터 ",
            parkingBikeTotCnt: "7",
            shared: "25",
            stationLatitude: "37.57447815",
            stationLongitude: "126.91004944",
            stationId: "ST-221",
          },
          {
            rackTotCnt: "22",
            stationName: "165. 중앙근린공원",
            parkingBikeTotCnt: "9",
            shared: "0",
            stationLatitude: "37.57513809",
            stationLongitude: "126.91394043",
            stationId: "ST-222",
          },
          {
            rackTotCnt: "22",
            stationName: "166. 가재울 초등학교",
            parkingBikeTotCnt: "6",
            shared: "0",
            stationLatitude: "37.57327652",
            stationLongitude: "126.91967773",
            stationId: "ST-223",
          },
          {
            rackTotCnt: "17",
            stationName: "167. 연가초등학교 옆",
            parkingBikeTotCnt: "12",
            shared: "0",
            stationLatitude: "37.57946014",
            stationLongitude: "126.91712952",
            stationId: "ST-224",
          },
          {
            rackTotCnt: "17",
            stationName: "169. 북가좌 삼거리",
            parkingBikeTotCnt: "6",
            shared: "0",
            stationLatitude: "37.57300186",
            stationLongitude: "126.90779877",
            stationId: "ST-226",
          },
          {
            rackTotCnt: "12",
            stationName: "170. 가재울 뉴타운 주유소 옆",
            parkingBikeTotCnt: "9",
            shared: "33",
            stationLatitude: "37.57311249",
            stationLongitude: "126.92244720",
            stationId: "ST-227",
          },
          {
            rackTotCnt: "12",
            stationName: "171. 임광빌딩 앞",
            parkingBikeTotCnt: "9",
            shared: "8",
            stationLatitude: "37.56472397",
            stationLongitude: "126.96727753",
            stationId: "ST-228",
          },
          {
            rackTotCnt: "10",
            stationName: "173. 서대문역 8번출구 앞",
            parkingBikeTotCnt: "4",
            shared: "0",
            stationLatitude: "37.56477737",
            stationLongitude: "126.96614838",
            stationId: "ST-230",
          },
          {
            rackTotCnt: "22",
            stationName: "175. 홍연2교옆",
            parkingBikeTotCnt: "6",
            shared: "0",
            stationLatitude: "37.57807159",
            stationLongitude: "126.93081665",
            stationId: "ST-231",
          },
          {
            rackTotCnt: "12",
            stationName: "176. 명지대학교 도서관",
            parkingBikeTotCnt: "0",
            shared: "0",
            stationLatitude: "37.58109665",
            stationLongitude: "126.92402649",
            stationId: "ST-555",
          },
          {
            rackTotCnt: "10",
            stationName: "177. 북가좌 초등학교",
            parkingBikeTotCnt: "1",
            shared: "0",
            stationLatitude: "37.57767487",
            stationLongitude: "126.90980530",
            stationId: "ST-345",
          },
          {
            rackTotCnt: "12",
            stationName: "178. 증산3교 앞",
            parkingBikeTotCnt: "0",
            shared: "0",
            stationLatitude: "37.57987595",
            stationLongitude: "126.90634918",
            stationId: "ST-349",
          },
          {
            rackTotCnt: "17",
            stationName: "179. 가좌역 4번출구 앞",
            parkingBikeTotCnt: "14",
            shared: "47",
            stationLatitude: "37.56912231",
            stationLongitude: "126.91479492",
            stationId: "ST-232",
          },
          {
            rackTotCnt: "12",
            stationName: "180. 충정로역 7번출구 아래",
            parkingBikeTotCnt: "10",
            shared: "8",
            stationLatitude: "37.55996704",
            stationLongitude: "126.96246338",
            stationId: "ST-233",
          },
          {
            rackTotCnt: "17",
            stationName: "181. 망원초록길 입구",
            parkingBikeTotCnt: "9",
            shared: "0",
            stationLatitude: "37.55134201",
            stationLongitude: "126.90267181",
            stationId: "ST-339",
          },
          {
            rackTotCnt: "12",
            stationName: "182. 망원2빗물펌프장 앞",
            parkingBikeTotCnt: "7",
            shared: "0",
            stationLatitude: "37.55156708",
            stationLongitude: "126.90284729",
            stationId: "ST-340",
          },
          {
            rackTotCnt: "17",
            stationName: "183. 하늘채코오롱아파트 건너편",
            parkingBikeTotCnt: "10",
            shared: "0",
            stationLatitude: "37.56516647",
            stationLongitude: "126.91939545",
            stationId: "ST-341",
          },
          {
            rackTotCnt: "11",
            stationName: "184. SK망원동주유소 건너편",
            parkingBikeTotCnt: "4",
            shared: "0",
            stationLatitude: "37.55894852",
            stationLongitude: "126.90775299",
            stationId: "ST-342",
          },
          {
            rackTotCnt: "17",
            stationName: "185. 마포 신수공원 앞",
            parkingBikeTotCnt: "5",
            shared: "0",
            stationLatitude: "37.54254532",
            stationLongitude: "126.93429565",
            stationId: "ST-343",
          },
          {
            rackTotCnt: "42",
            stationName: "186. 월드컵공원",
            parkingBikeTotCnt: "22",
            shared: "10",
            stationLatitude: "37.56396484",
            stationLongitude: "126.89820862",
            stationId: "ST-344",
          },
          {
            rackTotCnt: "12",
            stationName: "188. 홍은동 정원여중 입구",
            parkingBikeTotCnt: "2",
            shared: "0",
            stationLatitude: "37.58638763",
            stationLongitude: "126.93512726",
            stationId: "ST-346",
          },
          {
            rackTotCnt: "12",
            stationName: "191. 서우빌딩(바른학원)",
            parkingBikeTotCnt: "6",
            shared: "0",
            stationLatitude: "37.57889175",
            stationLongitude: "126.91073608",
            stationId: "ST-347",
          },
          {
            rackTotCnt: "12",
            stationName: "192. 연서어린이공원",
            parkingBikeTotCnt: "0",
            shared: "0",
            stationLatitude: "37.57222748",
            stationLongitude: "126.92306519",
            stationId: "ST-348",
          },
          {
            rackTotCnt: "12",
            stationName: "194. 증산교 앞",
            parkingBikeTotCnt: "2",
            shared: "0",
            stationLatitude: "37.57731628",
            stationLongitude: "126.90296936",
            stationId: "ST-350",
          },
          {
            rackTotCnt: "12",
            stationName: "195. 모래내고가차도 ",
            parkingBikeTotCnt: "6",
            shared: "42",
            stationLatitude: "37.56765747",
            stationLongitude: "126.91780853",
            stationId: "ST-351",
          },
          {
            rackTotCnt: "12",
            stationName: "196. 연희교차로 인근",
            parkingBikeTotCnt: "1",
            shared: "0",
            stationLatitude: "37.56612015",
            stationLongitude: "126.92589569",
            stationId: "ST-352",
          },
          {
            rackTotCnt: "17",
            stationName: "198. 충정2교",
            parkingBikeTotCnt: "15",
            shared: "0",
            stationLatitude: "37.56213760",
            stationLongitude: "126.96377563",
            stationId: "ST-354",
          },
          {
            rackTotCnt: "32",
            stationName: "199. 서울 월드컵 경기장",
            parkingBikeTotCnt: "7",
            shared: "0",
            stationLatitude: "37.56684494",
            stationLongitude: "126.89644623",
            stationId: "ST-443",
          },
          {
            rackTotCnt: "22",
            stationName: "200. 국회의원회관",
            parkingBikeTotCnt: "8",
            shared: "0",
            stationLatitude: "37.52841568",
            stationLongitude: "126.91391754",
            stationId: "ST-45",
          },
          {
            rackTotCnt: "17",
            stationName: "201. 진미파라곤 앞",
            parkingBikeTotCnt: "9",
            shared: "6",
            stationLatitude: "37.53123856",
            stationLongitude: "126.92133331",
            stationId: "ST-46",
          },
          {
            rackTotCnt: "32",
            stationName: "202. 국민일보 앞",
            parkingBikeTotCnt: "21",
            shared: "19",
            stationLatitude: "37.52881622",
            stationLongitude: "126.92453003",
            stationId: "ST-47",
          },
          {
            rackTotCnt: "17",
            stationName: "203. 국회의사당역 3번출구 옆",
            parkingBikeTotCnt: "14",
            shared: "76",
            stationLatitude: "37.52805710",
            stationLongitude: "126.91870117",
            stationId: "ST-51",
          },
          {
            rackTotCnt: "15",
            stationName: "204. 국회의사당역 5번출구 옆",
            parkingBikeTotCnt: "10",
            shared: "53",
            stationLatitude: "37.52816391",
            stationLongitude: "126.91702271",
            stationId: "ST-50",
          },
          {
            rackTotCnt: "22",
            stationName: "205. 산업은행 앞",
            parkingBikeTotCnt: "13",
            shared: "0",
            stationLatitude: "37.52626419",
            stationLongitude: "126.92050934",
            stationId: "ST-52",
          },
          {
            rackTotCnt: "37",
            stationName: "206. KBS 앞",
            parkingBikeTotCnt: "24",
            shared: "11",
            stationLatitude: "37.52466583",
            stationLongitude: "126.91802216",
            stationId: "ST-53",
          },
          {
            rackTotCnt: "42",
            stationName: "207. 여의나루역 1번출구 앞",
            parkingBikeTotCnt: "16",
            shared: "0",
            stationLatitude: "37.52698898",
            stationLongitude: "126.93209839",
            stationId: "ST-73",
          },
          {
            rackTotCnt: "14",
            stationName: "209. 유진투자증권빌딩 앞",
            parkingBikeTotCnt: "12",
            shared: "14",
            stationLatitude: "37.52461243",
            stationLongitude: "126.92783356",
            stationId: "ST-55",
          },
          {
            rackTotCnt: "23",
            stationName: "210. IFC몰",
            parkingBikeTotCnt: "16",
            shared: "13",
            stationLatitude: "37.52606583",
            stationLongitude: "126.92553711",
            stationId: "ST-56",
          },
          {
            rackTotCnt: "15",
            stationName: "211. 여의도역 4번출구 옆",
            parkingBikeTotCnt: "2",
            shared: "0",
            stationLatitude: "37.52222824",
            stationLongitude: "126.92463684",
            stationId: "ST-57",
          },
          {
            rackTotCnt: "37",
            stationName: "212. 여의도역 1번출구 옆",
            parkingBikeTotCnt: "9",
            shared: "0",
            stationLatitude: "37.52136230",
            stationLongitude: "126.92346191",
            stationId: "ST-58",
          },
        ];
        ```
        for (let i = 0; i < bikes.length; i++) {
        	if (bikes[i]['parkingBikeTotCnt'] <= 5) {
        		let station = bikes[i]['stationName'];
        		console.log(station);
        	}
        }

        마찬가지로 유용하게 쓸 수 있게, 함수로 만들어볼까요?

        function show_names(num){
        	for (let i = 0; i < bikes.length; i++) {
        		if (bikes[i]['parkingBikeTotCnt'] <= num) {
        				let station = bikes[i]['stationName'];
        				console.log(num + "대 이하 정류장 : " + station);
        		}
        	}
        }
        
        // 이러면 아래와 같은 것이 가능!
        show_names(10) // 10개 이하 주차된 정류소만 출력!
        show_names(5) // 5개 이하 주차된 정류소만 출력!

0개의 댓글