JavaScript(26)
-
Javascript 날짜에 패턴 적용하기
function formatCustomDate(date, pattern) { // Replace year, month, day, hours, minutes, seconds dynamically const replacements = { 'YYYY': date.getFullYear().toString(), 'MM': (date.getMonth() + 1).toString().padStart(2, '0'), 'DD': date.getDate().toString().padStart(2, '0'), 'HH24': date.getHours().toString().padStart(2, '0'), // 24-hour format 'HH': (da..
2024.12.05 -
Javascript 문자에서 접두사 검색
var str = "extTreePanel";if (str.startsWith('ext')) { console.log("The string starts with 'ext'.");} else { console.log("The string does not start with 'ext'.");}
2024.12.05 -
Javascript json 데이터 예쁘게 출력하기
원본 데이터[ { id: 1, name: 'John Doe', email: 'john.doe@example.com', age: 31 }, { id: 2, name: 'Jane Smith', email: 'jane.smith@example.com', age: 26 }]적용JSON.stringify(value, replacer, space)alert(`Saved ${changes.length} records:\n${JSON.stringify(changes, null, 4)}`);결과[ { "id": 1, "name": "John Doe", "email": "john.doe@example.com", "age": 31 }, { ..
2024.12.01 -
STS Javascript 자동완성 지원 설정
Help > Install New Software.Update: https://download.eclipse.org/wildwebdeveloper/releases/latest/ Eclipse software repository | The Eclipse FoundationThe Eclipse Foundation - home to a global community, the Eclipse IDE, Jakarta EE and over 360 open source projects, including runtimes, tools and frameworks.download.eclipse.org재시작
2024.12.01 -
Javascript에서 null 체크 간단하게 하기
&&를 사용해서, 먼저 객체가 null이 아닐 경우, 객체의 opertation이 작동하도록 함 만약 interaction이 null이거나 undefined이면 false가 되고, 결과값은 null이 됨 undoButton = interaction && interaction.getUndoButton(),
2024.11.24 -
Javascript 날짜 포멧 설정
const now = new Date();// Create a custom format: YYYY-MM-DD HH:mm:ssconst year = now.getFullYear();const month = (now.getMonth() + 1).toString().padStart(2, '0'); // Month is zero-basedconst day = now.getDate().toString().padStart(2, '0');const hours = now.getHours().toString().padStart(2, '0');const minutes = now.getMinutes().toString().padStart(2, '0');const seconds = now.getSeconds().toStrin..
2024.11.24