본문 바로가기

JS/learned_it_today

(15)
document와 document.documentElement
string.split('') 그리고 array.join('') string.split() white space 없을 때, 'abc'.split(''); //['a','b','c'] split a string into an array of its character white space 있을 때, 'abc'.split(' '); //['abc'] 그 string 그대로 array의 원소로 넣어준다. array.join() white space 없을 때, ['a','b','c'].join(''); //'abc' array에 있는 원소를 합쳐서 하나의 string으로 white space 있을 때, ['a','b','c'].join(' '); //'a b c' 하나의 string으로 만들어주는 것은 같지만 array 원소와 원소 사이에 한 칸 공백
스크롤을 내리는지 올리는지 보호되어 있는 글입니다.
스크롤 할 때 특정 class 추가, 멈추면 제거 보호되어 있는 글입니다.
<select> 기본 스타일 없애고 내가 원하는 스타일 넣기 HTML Pick a Movie: Parasite Bando Avengers: Endgame Harry Potter CSS .form-container select { background: #fff; padding: 0.4rem; margin: 0 0.2rem; border: 0; border-radius: 0.3rem; font-size: 0.9rem; appearance: none; -moz-appearance: none; -webkit-appearance: none; } .form-container select:focus { outline: 0; } appearance:none을 해주면 아래로 향하는 화살표가 사라진다. :focus selector를 사용해서 를 사용자가 누른 후 생기는 outlin..
JS에서 동적으로 생성한 태그에 클래스 만들어주기! const li = document.createElement("li"); const delBtn = document.createElement("button"); const span = document.createElement("span"); 클론 코딩한 ToDo리스트를 CSS로 다듬던 중 리스트나 버튼, span에 클래스 이름이 없어서 css로 꾸밀 수 없는 곤란한 상황이 발생했고 ! 검색결과 .setAttribute를 발견! li.setAttribute("class", "toDoList"); delBtn.setAttribute("class", "myBtn"); span.setAttribute("class", "toDoContent"); 리스트, 버튼, 스팬에 각각 클래스를 만들어 줄 수 있었고!!!!!..
함수 - return, 계산기 function sayHello(name, age){ return `Hello ${name} you are ${age} years old.`; } const greetNicolas = sayHello("Nicolas", 15) console.log(greetNicolas)​ function sayHello(name, age){ console.log(`Hello ${name} you are ${age} years old.`); } sayHello("Yunmi", 15); console.log("Hi") "hello", name, "you are" "hello"+name+"you are" 대신 `hello ${name}` function sayHello(name, age){ console.log(`Hello..
객체 - Property and Method Object Create Iterate Property&Method Property: 객체에 포함된 변수. 이 코드에서는 programmer, designer, bookkeeper, data scientist가 해당 Method: 객체에 포함된 함수. 이 코드에서는 ShowAll showAll 함수도 coworkers에 포함되기 때문에 가장 아랫줄에 나타남. 선생님이 나중에 if문으로 없앨 수도 있다고 하길래 혼자서 코드를 써봤고 Property&Method 원했던 대로 함수 없이 출력!