Skip to content

Instantly share code, notes, and snippets.

@SkyLightQP
Created November 5, 2020 11:57
Show Gist options
  • Select an option

  • Save SkyLightQP/7e4fd6c7e0ace531e6e95bcb2c4c74be to your computer and use it in GitHub Desktop.

Select an option

Save SkyLightQP/7e4fd6c7e0ace531e6e95bcb2c4c74be to your computer and use it in GitHub Desktop.
수정과 자바스크립트 강의 참고 자료
let a = 1;
let b = true;
let c = "가나다라";
console.log(typeof a); // number
console.log(typeof b); // boolean
console.log(typeof c); // string
// 함수 선언문
function fun(name) {
console.log(name);
return name;
}
const n = fun("이름");
console.log(n);
// 함수 표현식 (익명함수)
// 변수 이름 -> 함수 이름
const g = function (name) {
console.log(name);
};
g("진짜이름");
// 함수 표현식 (화살표 함수)
const x = (name) => {
console.log(name);
return name;
};
x("두번째이름");
// 즉시 실행 함수 (익명함수로 하거나 화살표함수로 하거나)
(() => {
console.log(1);
})();
let v = 1;
const add = (a) => {
return a + 1;
};
// a + 1를 반환받아 다시 변수 v에 넣음
v = add(v);
if (v > 1) {
console.log("1보다 큼");
} else {
console.log("1보다 작거나 같음");
}
// 구구단 2단
for (let i = 1; i <= 9; i++) {
if (i % 2 == 0) {
continue;
}
console.log(i * 2);
}
console.log(1 == "1"); // 값만 비교
console.log(1 === "1"); // 값하고 타입을 모두 비교
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment