사용자 도구

사이트 도구


wiki:javascript:javascript_note:화살표함수_정리

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
wiki:javascript:javascript_note:화살표함수_정리 [2022/12/22 19:12]
emblim98
wiki:javascript:javascript_note:화살표함수_정리 [2023/01/13 18:44] (현재)
줄 35: 줄 35:
 ({a, b} = { a: 10, b: 20 }) => expression ({a, b} = { a: 10, b: 20 }) => expression
 </code> </code>
 +\\
 +화살표 함수 변환 과정\\
 +<code javascript>
 +<!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>The filter() Method</title>
 +</head>
 +<body>
 +    
 +    <h1>JavaScript Arrays</h1>
 +    <h2>The filter() Method</h2>
  
 +    <p>Get every element in the array that has a value of 18 or more:</p>
 +
 +    <p id="demo"></p>
 +
 +    <script>
 +        const ages = [32, 33, 16, 40];
 +
 +        const filtered = ages.filter(function(age){return age >= 18;});
 +        console.log(filtered);
 +
 +        const filtered2 = ages.filter((age) => {return age >=18;});
 +        console.log(filtered2);
 +
 +        const filtered3 = ages.filter((age) => age >= 18);
 +        console.log(filtered3);
 +
 +        const filtered4 = ages.filter(age => age >= 18);
 +        console.log(filtered4);
 +        
 +        // 출력 결과 모두 동일
 +        // (3) [32, 33, 40]
 +        //  0: 32
 +        //  1: 33
 +        //  2: 40
 +        // length: 3
 +        // [[Prototype]]: Array(0)
 +
 +    </script>
 +</body>
 +</html>
 +</code>
  
  
줄 50: 줄 96:
 ===== Ref Link ==== ===== Ref Link ====
 [[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions|Arrow function expressions]]\\ [[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions|Arrow function expressions]]\\
 +[[https://www.w3schools.com/jsref/jsref_filter.asp|JavaScript Array filter()]]\\
 +[[https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Array/filter|Array.prototype.filter()]]\\
 +[[https://frhyme.github.io/jquery/jQuery11_Traversal_Filter/|jQuery - Traversal - Filter]]\\
 +[[https://developer-talk.tistory.com/114|[JavaScript]배열에서 특정 값의 개수]]\\
 +
  
  
 {{tag>오션 Javascript 화살표_함수_정리}} {{tag>오션 Javascript 화살표_함수_정리}}
/volume1/web/dokuwiki/data/attic/wiki/javascript/javascript_note/화살표함수_정리.1671703942.txt.gz · 마지막으로 수정됨: 2022/12/22 19:12 저자 emblim98