본문 바로가기

list

(124)
html javascript - easing cubic
html javascript - easing quadratic
html javascript - easing linear
html javascript - 코드로 html 파일 만들기 let htmlStr = '\n' + '\n' + ' \n' + ' \n' + ' label-label-label\n' + ' \n'+ ''htmlStr = htmlStr.replace('title-title-title', 'save html')htmlStr = htmlStr.replace('label-label-label', 'saved')saveHtml(htmlStr, 'save-html-file')function saveHtml(str, name) { const link = document.createElement('a') const file = new Blob([str], {type:'text/html'}) lin..
html javascript - array sort, reverse function init() { const arr0 = ['car','bus','aircraft','spacecraft','car1','motorcycle','car'] const arr1 = [ {name: 'car', type: 'land', cost: 100}, {name: 'bus', type: 'land', cost: 50}, {name: 'aircraft', type: 'sky', cost: 200}, {name: 'motorcycle', type: 'land', cost: 80}, {name: 'spacecraft', type: 'space', cost: 1000} ] const arr2 = [5,3,21,6,50,100,1,10,12,20,..
html javascript - array search (indexOf, find, includes) const arr0 = ['car','bus','aircraft','spacecraft','car','motorcycle','car']const index0 = arr0.indexOf('car')const index1 = arr0.lastIndexOf('car')console.log(index0) // 0console.log(index1) // 6const include0 = arr0.includes('bus')const include1 = arr0.includes('aircraft')const include2 = arr0.includes('warcraft')console.log(include0) // trueconsole.log(include1) // trueconsole.log(include2) //..
html javascript - array concat const arr0 = [1,2,3]const arr1 = [4,5,6]const arr2 = [7,8,9]const arr3 = arr0.concat(arr1, arr2)const arr4 = arr1.concat(arr2, arr0)const arr5 = arr0.concat(arr0, arr0)console.log(arr3) // [1,2,3,4,5,6,7,8,9]console.log(arr4) // [4,5,6,7,8,9,1,2,3]console.log(arr5) // [1,2,3,1,2,3,1,2,3]
html javascript - string replace const str0 = 'name: name-name-name, age: age-age-age'let str1 = str0.replace('name-name-name', 'Joker')str1 = str1.replace('age-age-age', '20')console.log(str1)// name: Joker, age: 20