-
[TIL] 0123카테고리 없음 2024. 1. 24. 09:56
ssd hdd 보조기억장치
ram 주기억장치
변수를 선언하면 주기억장치에 저장
보조기억장치에서 주기억장치로 가는걸 실행한다 라고 본다.
= 프로그램을 가동시킨다.
책상이 주기억장치
책이 보조기억장치
OOM.. out of memory
boot + ing -> booting
운영체제도 프로그램, 보조기억장치에 있는 운영체제가 주기억장치로 올라가는 행위가 부팅
데이터타입
number, string, boolean, undefined, null, object
const a = 1;
a 는 상수이고, 1은 리터럴
리터럴표기법이란, 변수를 선언함과 동시에 그 값을 지정해주는 표기법
class Myclass {
constructor(param1, param2){
this.property1 = param1;
}
}
class = 붕어빵틀
object (객체) = 붕어빵틀로 만들어질 것들 (가상) /추상적인 단어
instance = 붕어빵 틀로 만들어진 진짜 붕어빵 / 주기억장치, 메모리에 올라가는 순간 / 물리적인 존재
const arr = [1, 2, "5", true];
const arr2 = new Array(1,2,3, "&7);
//for i loop -> 순서나 횟수가 중요할때
for (let i=0; i<arr.length; i++){
log(arr[i]);
}
//while -> 특정 조건이 중요할때
let j = 0;
while (true) {
log(arr[j])
j= j+1;;
if(j>=arr.length){
break;
}
}
// if 조건문 = 데이터 타입이 무조건 불리언, 조건 덩어리만 올 수 있다.
const a = (1===2);
if(a){
}
강제 형변환 시에 0만 false, 나머지는 true
객체 선언을 해야 인스턴스
class Myclass {
constructor ( param1, param2 ) {
this. property1 = param1;
this. property2 = param2;
}};
object 를 잘 알아야 함
// 같은 목적을 위해 표현하는 방법이 너무 다양하기 때문에 어렵다.
const person = (name, age) => {
return {
name : name,
age : age,
"my att" : "ttt",
}
}
let bob = person ("john", 99);
console.log(john.name); // bob
dot literal
= console.log(john.name);
bracket literal // key 에 문자열이 들어갈 수 있기때문에 브라켓 리터럴이 있다.
= console.log(john["name"]);
뭐든 나오는 값만 보면 데이터형태를 알 수 있다. return 에 집중
type of 를 찍어보는 습관을 들이자.
function = 일급객체, 일급시민 , object 라 봐도 무방하다
age name 등 instance 변수, instance 마다 다른 값을 가질 수 있기 때문에
//prototype = 모든 person 객체가 공유하는 공간
// person 에 new method 를 추가하고 싶을 때
person.prototype.greet = function () {
console.log('hello,' + this.name + '!');
};
* object 는 닷 브라켓 리터럴 둘다 쓸 수 있다.
* prototype 을 어떻게 쓰느냐
// class new 나오면 인스턴스 라고 생각해도 된다.