JS- 리팩토링 중복의 제거

Jeongwon·2022년 1월 13일
0

Java Script

목록 보기
10/14

this 사용, 중복 제거

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>WEB1- JavaScript</title>
  </head>
  <body>
    <h1><a href="index.html">WEB</a></h1>

    <input type="button" value="night" onclick = "
    var target = document.querySelector('body');
    if(this.value=== 'night') {
      target.style.backgroundColor = 'black';
      target.style.color = 'white';
      this.value = 'day'
    } else {
      target.style.backgroundColor = 'white';
      target.style.color = 'black';
      this.value = 'night'
    }">
    <ol>
      <li><a href="html.html">HTML</a></li>
      <li><a href="css.html">CSS</a></li>
      <li><a href="javascript.html">JavaScript</a></li>
    </ol>
    <h2>JavaScript</h2>
    <p>
      JavaScript (/ˈdʒɑːvəˌskrɪpt/),[10] often abbreviated JS, is a
      programming language that is one of the core technologies of the
      World Wide Web, alongside HTML and CSS.[11] Over 97% of websites
      use JavaScript on the client side for web page behavior,[12] often
      incorporating third-party libraries.[13] All major web browsers have
      a dedicated JavaScript engine to execute the code on users' devices.
      JavaScript is a high-level, often just-in-time compiled language that conforms
      to the ECMAScript standard.[14] It has dynamic typing, prototype-based
      object-orientation, and first-class functions. It is multi-paradigm,
      supporting event-driven, functional, and imperative programming styles.
      It has application programming interfaces (APIs) for working with text,
      dates, regular expressions, standard data structures, and the Document
      Object Model (DOM).
    </p>
  </body>
</html>
profile
(❁´◡`❁)

0개의 댓글