본문 바로가기

전체 글

(124)
html javascript - string split const str0 = '123456789'const str1 = '1,2,3,4,5,6,7,8,9'const str2 = '1/2/3/4/5/6/7/8/9'const split0 = str0.split('')const split1 = str1.split(',')const split2 = str2.split('/')console.log(split0)console.log(split1)console.log(split2)// ["1","2","3","4","5","6","7","8","9"]
html javascript - array join const arr = [1,2,3,4,5,6,7,8,9]const arrJoin0 = arr.join(',')const arrJoin1 = arr.join('/')let arrJoin2 = arr.join('won ') // 1won 2won 3won 4won 5won 6won 7won 8won 9arrJoin2 += 'won'const arrJoin3 = arr.join('')console.log(arrJoin0) // 1,2,3,4,5,6,7,8,9console.log(arrJoin1) // 1/2/3/4/5/6/7/8/9console.log(arrJoin2) // 1won 2won 3won 4won 5won 6won 7won 8won 9wonconsole.log(arrJoin3) // 123456789
html javascript - input txt file
html javascript - clear canvas let canvas = document.getElementById('id-canvas') let ctx = canvas.getContext('2d') function clear() { ctx.clearRect(0, 0, canvas.width, canvas.height) }
html javascript - canvas size 화면에 꽉 채우기
html javascript - canvas size 화면에 맞추기 body와 canvas 사이의 기본 설정 값  : 16 (margin left, right), 21 (margin top, bottom)
html javascript - date string format function getDateStr00(date) { return date.toLocaleString()}function getDateStr00_01(date) { return date.toLocaleDateString()}function getDateStr00_02(date) { return date.toLocaleTimeString()}function getDateStr01(date) { const y = date.getFullYear() const m = date.getMonth() + 1 const d = date.getDate() const h = date.getHours() const mm = date.getMinutes() const s = date.getSeconds() ..
html javascript - 코드로 string 다운로드 저장 function saveString(fileName, str) { const link = document.createElement('a') const file = new Blob([str], {type:'text/plain'}) link.href = URL.createObjectURL(file) link.download = `${fileName}.txt` link.click() URL.revokeObjectURL(link.href)}