객체 선언 let obj = {name:"seogineer", age:20}; console.log(obj.name); //seogineer console.log(obj["name"]); //seogineer 객체 추가/삭제 obj["name"] = "seo"; console.log(obj); // { name: 'seo', age: 20 } obj.job = "developer" console.log(obj); // { name: 'seo', age: 20, job: 'developer' } 객체 탐색 //value값이 숫자인 key만 출력 const data = { "debug": "on", "window": { "title": "Sample Konfabul..
구조 WAS ㄴWeb Server ㄴWeb Container Web Server 웹브라우저로부터 HTTP 요청을 받아 정적인 컨텐츠를 제공 ex)html, jpg, css, js 정적인 컨텐츠는 WAS를 거치지 않고 바로 제공 동적인 컨텐츠는 요청(Request)을 WAS에 전달하고, WAS가 처리한 결과를 웹브라우저에게 응답(Response)한다. 예) Apache Server, Nginx, IIS WAS; Web Application Server Web Application Server = Web Server + Web Container 동적인 컨텐츠를 제공하기 위해 만들어진 Application Server. 예) 로직 처리, DB 접근 WAS는 Web Container 혹은 Servlet Cont..
배열 선언 //배열 선언 let arr = [1, 2, 3, "hello", null, true, []]; 배열 길이 //배열의 길이 arr.length; //결과:7 원소 추가 //배열 원소 추가 arr[2] = 99; //[ 1, 2, 99, 'hello', null, true, [] ] arr.push(3); //[ 1, 2, 99, 'hello', null, true, [], 3 ] 배열과 관련된 함수들 //indexOf(): 배열에 특정 값이 있는지 확인 arr.indexOf(99); //2 //join(): 배열을 문자열로 반환 arr.join(); //1,2,99,hello,,true,,3 arr.join(''); //1299hellotrue3 ar..
appendChild(노드) 자식 노드의 뒤에 노드가 삽입됨. 소스코드 let el = document.getElementById('form'); let input = document.getElementById('param1'); el.appendChild(input); 결과 insertBefore(노드, 기준 노드) 기준 노드의 앞에 노드가 삽입됨. 소스코드 let el = document.getElementById('form'); let input = document.getElementById('param1'); el.insertBefore(input, el.childNodes[4]); // el.childNodes[4] 앞에 input이 삽입..
parentElement 부모 element를 가져온다. parentNode 부모 element를 가져온다. 소스코드 button let el = document.getElementById('param1').parentElement; console.log(el); let el2 = document.getElementById('param1').parentNode; console.log(el2); 결과 차이점 parentElement: 부모 element 노드를 반환. 부모 element 노드가 더이상 없을 경우 null 반환한다. parentNode: 종류에 상관없이 부모 노드를 반환. parentElement는 까지 거슬러 올라가고, document까지 가고 싶지 않을 때 사..
querySelector('.클래스명') HTML에서 해당 클래스명를 사용하는 첫번째 요소를 찾음. getElementById('id') HTML에서 해당 id를 가지고 있는 요소를 찾음 소스코드 button let el = document.getElementById('param1'); let el2 = document.querySelector('.param'); console.log("document.getElementById('param1') : ", el); console.log("document.querySelector('param') : ", el2); 결과 참조 https://www.w3schools.com/..
Ajax(Asynchronous Javascript And XML) 웹페이지에서 데이터를 갱신할 때, 웹페이지 전체를 새로고침 없이 데이터를 갱신할 수 있는 기술 XMLHttpRequest 객체를 사용해서 서버와 통신한다. XML, Plain Text, JSON 포맷의 데이터를 주고 받을 수 있다. HttpRequest 만드는 방법 open(param1, param2, param3) param1(필수): HTTP 요구 방식(request method), GET, POST, HEAD 중 하나의 방식을 사용(대문자 사용 필수). param2(필수): 요청하는 URL. param3(선택): 비동기식(Asynchronous) 여부, true가 기본값. send("data") POST 방식으로 요청한 경우 서버로..
Git 작업 흐름 Working directory(작업 디렉토리): 실제 소스 파일들 존재. add 명령으로 Stage로 보냄. Index(Stage): 준비 영역. commit 명령으로 HEAD로 보냄 HEAD: 최종 확정본 사용방법 local에 폴더를 먼저 만든 경우 $ git init //저장소로 만들고 싶은 폴더로 이동해서 명령 실행 $ git add * $ git commit -m "commit에 대한 설명" $ git remote add origin //github에서 미리 repository를 만든다. $ git push origin master github에 저장소를 먼저 만든 경우 $ git clone //github에서 미리 repository를 만든다. $ git add * $ git..