잘실행되던 node가 갑자기 실행해보니 아래와 같이 에러가 발생 node-telegram-bot-api deprecated Automatic enabling of cancellation of promises is deprecated. In the future, you will have to enable it yourself. See https://github.com/yagop/node-telegram-bot-api/issues/319. node:internal/modules/cjs/loader:1099:14 제일 쉬운 해결방법은 제일 상단에 아래와 같이 선언 process.env.NTBA_FIX_319 = 1 자세한 내용은 아래 글 참조 https://stackoverflow.com/questions/6..
let arr = [ { name: 'apple', price: 1000 }, { name: 'banana', price: 500 }, { name: 'orange', price: 800 } ]; let sum = 0; for (let i = 0; i < arr.length; i++) { sum += arr[i].price; } console.log(sum); // 2300 숫자배열이 아닌 객체안에서 특정값을 구할때는 아래와 같이 한다. // 숫자배열 합 for문이용 let arr = [1, 2, 3, 4, 5]; let sum = 0; for (let i = 0; i < arr.length; i++) { sum += arr[i]; } console.log(sum); // 15 // reduce 이용 ..
function addCommas(num) { return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); } addCommas("1000") => 1,000
function checkOverlap(rectangles) { for (let i = 0; i < rectangles.length; i++) { const rect1 = rectangles[i]; // 첫번째 사각형의 왼쪽, 오른쪽, 위, 아래 좌표를 구합니다. const left1 = rect1[0]; const right1 = rect1[1]; const top1 = rect1[2]; const bottom1 = rect1[3]; for (let j = i + 1; j < rectangles.length; j++) { const rect2 = rectangles[j]; // 두번째 사각형의 왼쪽, 오른쪽, 위, 아래 좌표를 구합니다. const left2 = rect2[0]; const right2..
billboard.js mouserover expand disable 마우스 오버시 확대되는걸 막을때 사용 point: { focus: { expand: { enabled: false } } }
해당 달이 몇주가 있는지 확인할 때 function maxWeeksInMonth(year, month) { var firstOfMonth = new Date(year, month-1, 1); var lastOfMonth = new Date(year, month, 0); var used = firstOfMonth.getDay() + lastOfMonth.getDate(); return Math.ceil( used / 7); }
내 블로그 - 관리자 홈 전환 |
Q
Q
|
---|---|
새 글 쓰기 |
W
W
|
글 수정 (권한 있는 경우) |
E
E
|
---|---|
댓글 영역으로 이동 |
C
C
|
이 페이지의 URL 복사 |
S
S
|
---|---|
맨 위로 이동 |
T
T
|
티스토리 홈 이동 |
H
H
|
단축키 안내 |
Shift + /
⇧ + /
|
* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.