보간법

2022. 11. 29. 13:30·Development/javascript
반응형

 

 
element-${}

위와 같이 달러 표시와 중괄호를 사용하는 것을 보간법이라 한다.

보간법을 사용하기 위해서는 backtick 기호(`)를 사용해야 한다.

`element-${}`

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./css/main.css" />
    <script defer src="./js/main.js"></script>
</head>
<body>
    <div class="div">div element 1</div>
    <div class="div">div element 2</div>
    <div class="div">div element 3</div>
    <div class="div">div element 4</div>
    <div class="div">div element 5</div>
</body>
</html>
const divElems = document.querySelectorAll('.div');

divElems.forEach(function(item, index) {
    console.log(`item index: ${index}`);
});

반응형
저작자표시 비영리 변경금지 (새창열림)

'Development > javascript' 카테고리의 다른 글

callback으로 받은 값 사용하는 법  (0) 2022.11.30
메소드 체이닝  (0) 2022.11.30
defer  (0) 2022.11.29
'Development/javascript' 카테고리의 다른 글
  • callback으로 받은 값 사용하는 법
  • 메소드 체이닝
  • defer
doh.k
doh.k
  • doh.k
    DOHk's DevLog
    doh.k
  • 전체
    오늘
    어제
    • 분류 전체보기
      • DailyLog
      • TIL
      • Project
        • Development
        • Artificial Intelligence
      • Development
        • Database
        • WEB
        • CSE
        • javascript
        • Algorithms
        • Linux
        • Network
        • Python
        • 라즈베리파이
        • Apple
      • Research
        • 논문
        • 금융,블록체인
        • Time-Series
        • 수학
        • 미적분학
        • 화학
      • Artificial Intelligence
        • Machine Learning
        • Deep Learning
        • TensorFlow
        • ReinforcementLearning
      • 기타
  • 블로그 메뉴

    • 홈
    • 태그
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    라즈베리파이
    자바스크립트
    데이터
    딥러닝
    스프링
    gradient descent
    리눅스
    ssh
    파이썬
    Machine Learning
    데이터베이스
    머신러닝
    Network
    Algorithms
    JavaScript
    gradient
    경사하강법
    pycharm
    Python
    맥북
    아이패드
    자료구조
    Spring
    Mac
    가상화폐
    알고리즘
    Linux
    기계학습
    블록체인
    네트워크
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
doh.k
보간법
상단으로

티스토리툴바