JavaScript_concept

h_zee·2023년 11월 23일
0

JavaScript

목록 보기
1/5
post-thumbnail

JavaScript

  • 웹브라우저에서 동적으로 웹페이지를 바꾸고 이벤트를 처리하는 언어.
  • 객체지향, 인터프리터, 동적

📖 Object

  • Array
var data=[1,2,3,'A'];
consol.log(typeof data,data);
function Person(name) {
	this.name=name;
}

var person=new Person('John');
console.log(person);
  • json object : 데이터 주고받을때 주로 사용되는 데이터 포맷.
var obj={name:'John', address:'USA'};
var json = JSON.stringify(obj);

console.log(typeof obj, obj);
console.log(typeof json, json);
var jsonObj = JSON.parse(json);
console.log(typeof jsonObj, jsonObj);
  • web browser object : window , location , document
// window object

var data 10;
var add = function(num1,num2) {
	return num1 + num2;
}

console.log(window.data);
console.log(window.add(10,20));
// location object

location.href        // 현재 페이지 url
location.origin      // 현재 페이지 domain
location.pathname    // 현재 페이지 path
loaction.prot        // 현재 페이지 port
// document object

document.title       // 현재 페이지 title

📖 element 선택

  • 아이디 : document.getElementById()
  • 클래스 : document.getElementByClassName()
  • 속성값 : document.getElementByName()
  • 태그 : document.getElementByTagName()
  • 셀렉터 : document.querySelector()

✍️ 공부한 내용을 정리하는 공간이기 때문에, 정확하지 않은 사실이 들어갈 수 있습니다.

profile
하루하루 성실하게 (비공개 블로그입니다-일부공개)

0개의 댓글

관련 채용 정보