일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- Replication
- listener 1883
- map이 undefined가 뜰 때
- setInterval 중지
- setInterval 외부 정지
- html #select #option #multiple
- pm2
- setInterval clear
- timepicker
- 1883
- c# datagridview 데이터 넣기
- pm2 상태 확인
- DatePicker
- invalid data
- mosquitto
- setInterval 정지
- allow_anonymouse
- 공인IP
- mySQL_Replication
- 서버동기화
- datagridview 직접입력
- pm2 설치
- 데이터테이블 데이터 넣기
- pm2 시작
- 맥 어드레스
- transfer
- DataGridView 직접 입력
- mosquitto.conf
- AntDesign
- pm2 확인
- Today
- Total
목록분류 전체보기 (741)
개발 노트
- array 자료 갯수만큼 함수안의 코드 실행해줌 - 함수의 파라미터는 array안에 있던 자료 - return에 반환값 적으면 array로 담아줌 let arr = [10, 20 ,30] let a = arr.map(function (item, i) { return item }) console.log(a) // [10, 20, 30] item은 배열에 각 요소 (여기서는 10, 20, 30) i는 인덱스로 0부터 시작 (여기서는 0, 1, 2)
?? 왼쪽값이 null or undefined이면 오른쪽 값이 선택된다. let data = { name : 'song', age : 26, job : null } console.log(data.name ?? '정보없음') // song console.log(data.age ?? '정보없음') // 26 console.log(data.job ?? '정보없음') // 정보없음 console.log(null ?? '로딩중...'); // 로딩중... console.log(undefined ?? '로딩중...'); // 로딩중... console.log('실행' ?? '로딩중...'); // 실행 언제 사용할까? : ajax 요청 등 때문에 값이 늦게 도착할 때 (특히, React나 Vue 쓸 때 유용)
객체 내부의 중첩된 속성이나 메서드에 접근할 때, 해당 경로에 값이 없는 경우 에러를 발생시키지 않고 안전하게 처리할 수 있는 방법이다. 존재하지 않을 수 있는 중첩된 객체 구조를 다룰 때 유용하며, 코드의 안정성을 높이는 데 도움이 된다. // 사용 전 var user = { name: 'song', // age: {value: 15}, } console.log(user.age.value);// 에러발생 // 사용 후 var user = { name: 'song', // age: {value: 15}, } console.log(user.age?.value);// undefined를 출력
함수를 사용할 때, 파라미터에 값이 없다면 undefined가 출력된다. Default parameters를 사용하면 파라미터에 값이 없을 때, 출력하는 초기값을 설정할 수 있다. let func = function(res){ console.log(res); } // 사용 전 func() // undefined // 사용 후 func(res = 'hello') // hello 파라미터가 여러 개 있는 함수지만 1개만 써도 에러가 발생하지 않는다. function 더하기(a, b, c){ console.log(a); } 더하기(1); // 1 함수의 defalut 값을 줄 수 있다. function 더하기(a, b, c=3){ console.log(a + b + c); } 더하기(600, 10); // 6..
객체 혹은 배열들을 펼칠 수 있게 해주는 문법 사용가능 공간 : 중괄호, 대괄호, 소괄호 안에서만 가능 객체인 경우 let obj1 = { name : 'song', age : 26 } let obj2 = {...obj1}; console.log(obj1); // {name : 'song', age : 26} console.log(obj2); // {name : 'song', age : 26} // 객체 속성값 추가 let obj3 = {...obj2, birth : 'march'}; console.log(obj3); // {name : 'song', age : 26, birth : 'march'} // 객체 값 합치기(concat) let product1 = { name : 'water', price ..
배열 혹은 객체에서 각각에 value, property를 쉽게 분해하여 변수에 담을 수 있다. 객체에서 사용하는 법 // 객체 선언 및 할당 let std = { name: 'song', num: 12, } // 사용 전 let name = std.name; let num = std.num; console.log(name); // song console.log(num); // 12 // 사용 후 let { name, num } = std; console.log(name); // song console.log(num); // 12 배열에서 사용하는 법 // 배열 선언 및 할당 let std_arr = ['song', 'kim', 'park']; // 사용 전 let one = std_arr[0]; let ..