TIL09 JavaScript & HTML/CSS

shnae·2023년 10월 31일
1
post-thumbnail

Strict Mode

엄격모드로 코드를 실행한다
Strict Mode를 사용하면 hoisting을 할 수 없다

ReferenceError: a is not defined
    at Object.<anonymous> (/Users/shinhyekang/Documents/Blockchain-School/231031/a.js:3:3)
    at Module._compile (node:internal/modules/cjs/loader:1191:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1245:10)
    at Module.load (node:internal/modules/cjs/loader:1069:32)
    at Function.Module._load (node:internal/modules/cjs/loader:904:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:22:47

eval

절대 사용하지 않는 JavaScript 키워드 중에 하나다.
프로그램이 여러 가지 주입 공격에 노출될 수 있기 때문이다.

console.log("2 + 2");

console.log(eval("2 + 2"));
console.log(typeof eval("2 + 2"));

2 + 2
4
number

eval("var a = 1; console.log(a);");
eval("const a = () => console.log(11); a();");

1
11

  • eval 매개변수에 함수를 넣어주면 실행되는 것을 볼 수 있다.

hover

transform: scale()

transition: all 0.5s;

justify-items: center;


grid

  • flex 는 일차원적인 개념이고, grid는 2차원적인 개념이다.
  • 웹사이트 내 카드 나열 등의 작업은 grid 사용을 권장한다.

block

block-inline

inline

  • 크기값을 변경할 수 없음

div

  • default block
  • 가로 세로 값을 가질 수 있다

span

  • inline
  • 줄바꿈도 안되고, 가로세로 값을 가질 수 없다

0개의 댓글