
3티어
was
백엔드 API 개발 = 프론트엔드와 주고 받을 데이터를 처리하기 위한 서버 프로그램을 개발
API 프로그램을 서버에서 실행하면 = API 서버
아이디 클래스 태그 전체 순으로
media
@media(max-width:1280px) {
body {
background-color: pink;
}
}
padding
font-size
text-align
border-bottom
flex는 부모에만 적용(부모 자식 간)
justify-content: space-between/flex-right/flex-left…
html, body {
height: 100%;
}
body {
display: flex;
/* justify-content: center; */
align-items: center;
}
가상선택자
<style>
* {
margin: 0;
padding: 0;
}
body {
margin: 0 auto;
width: 960px;
}
</style>
one true ->html4, 구식?이지만 호환성이 좋다(Ex 익스플로러)
flex ->html5, 간편하지만 호환성의 문제가 있다
rem : 글꼴의 크기를 지정하는 단위(상대적 단위- 해상도에 따라 유동적 변경가능
px : 페이지의 크기를 줄이든 키우든 같은 크기를 갖는다. (절대적 단위)
overflow 속성
내용 요소가 크기를 벗어날 때 어떻게 처리할 지를 정하는 속성
background-image: url("") 이미지 주소를 지정하면 해당 이미지를 불러온다.
borader-radius : 요소의 테두리를 둥글게 만든다.
max-width : 최대 너비를 지정
text-align : 텍스트 정렬 (left, right, center, justify)
css bem
부정가상클래스
// 함수의 기본 사용법
const f = function () {return "100"};
console.log(f());
// 익명함수 : 매개변수가 1개일 때는 () 생략 가능
const af = a => {return 200 + a};
console.log(af(20));
// 익명함수 : 매개변수가 2개 이상일 때는 () 생략 불가능
const af = (a, b) => {return a + b};
console.log(af(3, 4));
const calc = {
firstNumber: 100,
secondNumber: 20,
print: function () {
console.log(this);
//여기서 this 는 calc 객체를 가르킨다
function add() {
console.log(this);
return this.firstNumber + this.secondNumber;
}
console.log(this.firstNumber + " + " +this.secondNumber + add());
}
}
calc.print();
//
const calc = {
firstNumber: 100,
secondNumber: 20,
print: function () {
let self = this;
function add() {
console.log(self);
return self.firstNumber + self.secondNumber;
}
console.log(add());
}
}
calc.print();
//promist 기본 형태
var promise = new Promise(function(resolve, reject) {...});
<script>
function welcome() {
return new Promise(function (resolve, rejuct) {
setTimeout(function () {
console.log("Welcome");
resolve();//프로미스 객체를 이행상태로 만든다
}, 1000);
});
}
function to() {
return new Promise(function (resolve, reject) {
setTimeout(function () {
console.log("to");
resolve();
}, 1000);
});
}
function world() {
return new Promise(function (resolve, reject) {
setTimeout(function () {
console.log("World");
resolve("!");
}, 1000);
});
}
function end(response) {
console.log(response);
}
welcome()
.then(function (response) {
return to();
})
.then(function (response) {
return world();
})
.then(function (response) {
end(response);
});
console.log("Executed!!");
</script>
/* 실행결과:
Welcome
to
World
!
*/
//member1.js
let name = "홍길동";
let age = "10";
let company = "교동초등학교";
let member = {
getName: function () {
return name;
},
setName: function (newName) {
name = newName
},
...
}
export default member;
--------------------------------------------------------------------
//member2.js
import member from "./member1.js"
console.log(`${member.getName()}은 ${member.getAge()}살이고 ${member.getCompany()}에 다닙니다.`);
member.setCompany("역삼중학교");
console.log(`${member.getCompany()}에 다닙니다.`);
--------------------------------------------------------------------
//member.html
<!DOCTYPE html>
<html>
<body>
<script src="./member2.js" type="module"></script>
</body>
</html>

var numbers = [2, 6, 3, 4, 8];
console.log(numbers.sort(function (a, b) {
return a - b
}));
console.log(numbers.sort(function (a, b) {
return b - a
}));
var persons = [
{
name: "Alex",
age: "29"
}, {
name: "Jaejun",
age: "39"
}, {
name: "Taehwan",
age: "20"
}
];
persons.sort(function (a, b) {
return b.age - a.age;
});
console.log(persons);
persons.sort(function (a, b) {
var x = a.name.toLowerCase;
var y = b.name.toLowerCase;
if (x < y) {
return -1;
}
if (x > y) {
return 1;
}
return 0;
});
console.log(persons);
var text = "";
var numbers = [4,2,8,6,5,9];
numbers.forEach(myFunc);
function myFunc(v){
text = text + v + "<br>";
}
var numbers1 = [1,2,3,4,5];
var numbers2 = numbers1.map(myFunc1);
function myFunc1(value, index, array){
return value*2;
}
var numbers3 = numbers1.filter(myFunc2);
function myFunc2(value, index, array){
return value > 3;
}
var numbers4 = [1,2,3,4,5];
var total = numbers4.reduce(myFunc4, 100);
function myFunc4(total, value){
return total + value;
}
var total2 = numbers4.reduceRight(myFunc5);
function myFunc5(total, value, index, array){
return total + value;
}
var fruits = ["apple","orange","melon"];
var fruit = fruits.indexOf("apple");
console.log(fruit);
var findNum = numbers4.find(myFunc6);
function myFunc6(value){
return value>3;
}
new Vue({
components: {},
});
<script>
Vue.component("컴포넌트명", {...});
});
추가 설치
npm install -g @vue/cli