filter() 조건에 만족하는 배열 요소 검색 : 반환(배열) { const arrNum = [100, 200, 300, 400, 500] const result = arrNum.filter (el => el === 300); //결과값 : 300 const arrNum2 = [100, 200, 300, 400, 500] const result2 = arrNum2.filter (el => el === 600); //결과값 : 없음 const arrNum3 = [100, 200, 300, 400, 500]; const result3 = arrNum3.filter(el => el >= 300); //결과값 : 300,400,500 } map() 배열 요소를 추출하여 새로운 배열로 만듦 : 반환(배열) { ..
find() 배열 요소 검색 : 반환(요소) { //기본값 : [100, 200, 300, 400, 500] const result = arrNum.find(el => el === 300) //결과값 : 300 //기본값 : [100, 200, 300, 400, 500] const result2 = arrNum.find(el => el === 600) //결과값 : undefined const arrText3 = ["javascript", "react", "vue"]; const result3 = arrText3.find(el => el ==="javascript"); //결과값 : javascript } findIndex() 배열 첫 요소 검색 : 반환(숫자) { //기본값 : ['javascript'..
indexOf() 배열 요소 검색 : 반환(숫자) { //기본값 : [100, 200, 300, 400, 500] const arrNum = [100, 200, 300, 400, 500]; const arrIndex = arrNum.indexOf(200); //결과값 : 1 const arrNum2 = [100, 200, 300, 400, 500]; const arrIndex2 = arrNum2.indexOf(300); //결과값 : 2 const arrNum3 = [100, 200, 300, 400, 500]; const arrIndex3 = arrNum3.indexOf(600); //결과값 : -1 } lastIndexOf() 배열 요소 끝에서 검색 : 반환(숫자) { //기본값 : [100, 200..
sort() 배열 요소를 정렬 : 반환 (배열) { const arrNum2 = [100, 200, 300, 400, 500]; const arrNumSort2 = arrNum2.sort(); const arrNum3 = [100, 200, 300, 400, 500]; const arrNumSort3 = arrNum3.sort(function(a,b){return b-a}); //결과값 : 500,400,300,200,100 const arrNum4 = [500, 400, 300, 200, 100]; const arrNumSort4 = arrNum4.sort(function(a,b){return a-b}); //결과값 : 100,200,300,400,500 const arrNum5 = ['c', 'd',..
{ const paragraphs = [ "1one in four American adults is unvaccinated or only partially vaccinated, and that number isnt budging much these days. Fewer than 80,000 adults are getting their first shot every day a 96% drop from the more than 2 million a day in April 2021. Its easy to believe that anyone who hasnt gotten a shot by now is unlikely to get one in the future—but there is still a group o..
{ const musicWrap = document.querySelector(".wrap__music"); const musicImg = musicWrap.querySelector(".music__img img"); const musicName = musicWrap.querySelector(".music__song .name"); const musicArtist = musicWrap.querySelector(".music__song .artist"); const musicAudio = musicWrap.querySelector("#main-audio"); const musicPlay = musicWrap.querySelector("#control-play"); const musicPrevBtn = mus..
{ //01. HTML/CSS 구성 //02. 클릭한 카드 뒤집기 //03. 두개의 카드 뒤집어서 같은지 확인 (첫번째, 두번째) //04. 클릭한 카드의 두개의 이미지 가져오기 //05. 두개의 이미지 비교하기 //06. 틀린 이미지 애니메이션 효과 주기 //07. 빨리 클릭하면 버그 발생 처리하기 const cards = document.querySelectorAll(".cards li"); let cardOne, cardTwo; let disableDeck = false; function flipCard(e){ //클릭 카드 = e 타겟 let clickedCard = e.target; if(clickedCard !== cardOne && !disableDeck){ //(빨리 클릭 버그)클릭카드와 ..
집계함수 { CREATE TABLE myRecode ( recodeID int(10) unsigned auto_increment, memberID int(10) unsigned, javascript tinyint unsigned NOT NULL, html tinyint NOT NULL, css tinyint NOT NULL, mysql tinyint NOT NULL, react tinyint NOT NULL, PRIMARY KEY (recodeID) ) charset=utf8; INSERT INTO myRecode(memberID, javascript, html, css, mysql, react) VALUE(1, 60, 30, 10, 20, 20); INSERT INTO myRecode(memberID,..