JavaScript

· JavaScript
참고 사이트 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters#destructured_parameter_with_default_value_assignment 🔮 Destructured parameter with default value assignment 함수를 호출 할 때, 인자를 주지 않으면 기본 값으로 설정 function preFilledArray([x = 1, y = 2] = []) { return x + y; } preFilledArray(); // 3 preFilledArray([]); // 3 preFilledArray([2]); // 4 preFilledArray([2,..
· JavaScript
🧷 Logical AND - && 모든 조건이 참이어야 true true && expression: 왼쪽 피연산자가 true이면, 우측 피연산자 반환 false && expression: 왼쪽 피연산자가 false이면, 왼쪽 피연산자 반환 function printNum(num) { console.log(num) } true && printNum(10); // output: 10 true && true && printNum(20); // output: 20 false && printNum(30); // output: false console.log(true && true); // output: true console.log(false && true); // output: false console.log(..
presentKey
'JavaScript' 카테고리의 글 목록 (2 Page)