<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>kjh_0218.log</title>
        <link>https://velog.io/</link>
        <description>개발꿈나무 🌱 </description>
        <lastBuildDate>Wed, 02 Jun 2021 12:37:52 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <image>
            <title>kjh_0218.log</title>
            <url>https://images.velog.io/images/kjh_0218/profile/6574343b-895e-4ee3-8a21-c773e5585200/social.png</url>
            <link>https://velog.io/</link>
        </image>
        <copyright>Copyright (C) 2019. kjh_0218.log. All rights reserved.</copyright>
        <atom:link href="https://v2.velog.io/rss/kjh_0218" rel="self" type="application/rss+xml"/>
        <item>
            <title><![CDATA[javascript로 요소 가져오기]]></title>
            <link>https://velog.io/@kjh_0218/javascript%EB%A1%9C-%EC%9A%94%EC%86%8C-%EA%B0%80%EC%A0%B8%EC%98%A4%EA%B8%B0</link>
            <guid>https://velog.io/@kjh_0218/javascript%EB%A1%9C-%EC%9A%94%EC%86%8C-%EA%B0%80%EC%A0%B8%EC%98%A4%EA%B8%B0</guid>
            <pubDate>Wed, 02 Jun 2021 12:37:52 GMT</pubDate>
            <description><![CDATA[<p>#getElementById</p>
<p>#getElementsByClass</p>
<pre><code>&lt;div class=&quot;boxs&quot;&gt;
  &lt;div id=&quot;box1&quot;&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;script&gt;
    //html 요소를 javascript로 가져오기
    let box1 = document.getElementById(&#39;box&#39;);
&lt;/script&gt;
</code></pre><p>#querySelectorAll</p>
<pre><code>&lt;div&gt;
  &lt;span&gt;1-1&lt;/span&gt;
  &lt;span&gt;1-2&lt;/span&gt;
&lt;/div&gt;
&lt;div&gt;
  &lt;span&gt;2-1&lt;/span&gt;
  &lt;span&gt;2-2&lt;/span&gt;
&lt;/div&gt;
&lt;script&gt;
  let elements = document.querySelectorAll(&#39;div &gt; span:last-child&#39;);

  for (let elem of elements) {
    alert(elem.innerHTML); // &quot;1-2&quot;, &quot;2-2&quot;
  }
&lt;/script&gt;</code></pre><p>#elem.querySelector(css) 
주어진 CSS 선택자에 대응하는 요소 중 첫 번째 요소 반환(=elem.querySelectorAll(css)[0])
elem.querySelectorAll(css)[0]? 선택자에 해당하는 모든 요소를 검색해 첫 번째 요소만을 반환
elem.querySelector는 해당하는 요소를 찾으면 검색을 멈춤
=&gt; elem.querySelector가 더 빠르고 querySelectorAll에 비해 코드의 길이가 짧음</p>
<h2 id="queryselector--gerelement">querySelector &gt;&gt; gerElement</h2>
]]></description>
        </item>
        <item>
            <title><![CDATA[끝말잇기]]></title>
            <link>https://velog.io/@kjh_0218/%EB%81%9D%EB%A7%90%EC%9E%87%EA%B8%B0</link>
            <guid>https://velog.io/@kjh_0218/%EB%81%9D%EB%A7%90%EC%9E%87%EA%B8%B0</guid>
            <pubDate>Sat, 27 Mar 2021 08:50:37 GMT</pubDate>
            <description><![CDATA[<pre><code>var word = &quot;끝말잇기 첫단어&quot;

while(true) {
  var answer = prompt(word);
  if (word[word.length-1] === answer[0]){
      alert(&quot;딩동댕&quot;);
    word = answer;
}else{
  alert(&quot;바보&quot;)
}
}</code></pre><pre><code>for (var word = &quot;&quot;;true;){
  var answer = prompt(word);
    if (word[word.length-1] === answer[0]){
      alert(&quot;딩동댕&quot;);
      word = answer;
  }else{
    alert(&quot;바보&quot;)
}
}</code></pre>]]></description>
        </item>
    </channel>
</rss>