콜백 함수(call back func) // 매개 변수가 있는 사용자 정의 콜백 함수 예제 // 숫자 배열을 입력으로 받아 각 요소를 변환하는 함수 function transformArray(arr, callback) { const transformedArray = arr.map(callback); return transformedArray; } // 사용자 정의 콜백 함수 function squareNumber(num) { return num * num; } function addOne(num) { return num + 1; } // 숫자 배열 const numbers = [1, 2, 3, 4, 5]; // squareNumber 함수를 사용하여 숫자 배열의 각 요소 제곱 const squaredNu..
// 빈 객체 배열 생성 const peopleArray = []; // 객체 추가 peopleArray.push({ name: 'Alice', age: 30, occupation: 'Engineer' }); peopleArray.push({ name: 'Bob', age: 25, occupation: 'Designer' }); peopleArray.push({ name: 'Charlie', age: 40, occupation: 'Manager' }); console.log(peopleArray);
숫자 배열 정렬 예시: let arr = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]; arr.sort((a, b) => a - b); // 오름차순 정렬 console.log(arr); arr.sort((a, b) => b - a); // 내림차순 정렬 console.log(arr); 문자열 배열 정렬 예시: let arr = ["banana", "apple", "orange", "grape"]; arr.sort(); // 알파벳 순서로 정렬 (기본적으로 오름차순) console.log(arr); arr.sort((a, b) => b.localeCompare(a)); // 알파벳 역순으로 정렬 (내림차순) console.log(arr); 사용자 정의 객체 배열 정렬 예시: (숫자) //..
클릭 후 이동 // 이동 가능한 div 요소 선택 const movableDiv = document.getElementById('movableDiv'); // 이동 가능한 상태를 저장하는 변수 let isMovable = false; // div를 클릭할 때 호출되는 이벤트 리스너 movableDiv.addEventListener('mousedown', function(event) { isMovable = true; // 이동 가능한 상태로 설정 offsetX = event.clientX - movableDiv.offsetLeft; offsetY = event.clientY - movableDiv.offsetTop; }); // div를 놓을 때 호출되는 이벤트 리스너 document.addEventLi..
append(): Inserts the specified content as the last child of the target element. prepend(): Inserts the specified content as the first child of the target element. after(): Inserts the specified content immediately after the target element. before(): Inserts the specified content immediately before the target element. // Add an element using append() $(targetElementSelector).append('This is a ne..
function formatProductCode(input) { // Remove any non-alphanumeric characters from the input value let productCode = input.value.replace(/[^a-zA-Z0-9]/g, ''); // Format the product code as desired (e.g., jh-h-09-09) let formattedProductCode = productCode.replace(/([^A-Za-z]{2})([^A-Za-z])(\d{1,2})(\d{1,2})/, (match, p1, p2, p3, p4) => p1.toUpperCase() + '-' + p2.toUpperCase() + '-' + p3 + '-' + ..
// Create a new option element. var option = document.createElement("option"); // Set the text and value properties of the option element. option.text = "Option Text"; option.value = "Option Value"; // Append the option element to the select element. var select = document.getElementById("mySelect"); select.appendChild(option);
- Total
- Today
- Yesterday
- .submit()
- 아이폰
- In App Purchase
- 문자 자르기
- system.io
- 진수 변환
- 명령어
- nl2br
- 상품 등록
- 특정 문자를 기준으로 자르기
- async
- FileUpload
- await
- trim
- 제품 등록
- 앱 스토어
- html tag
- App Store
- System.Diagnostics
- MainActor
- 공백제거
- hyper-v
- Task
- mssql
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 | 31 |