본문 바로가기

코딩테스트/리디야 할리 JS Quiz10

JS Quiz 33-36. call, bind / 즉시실행함수 / falsy-truthy 값 / typeof 연산자 33. What's the output? const person = { name: 'Lydia' }; function sayHi(age) { return `${this.name} is ${age}`; } console.log(sayHi.call(person, 21)); console.log(sayHi.bind(person, 21)); 정답 D // call. bind 2024-04.12 공부 필요 다시 해석 달기! 34. What's the output? function sayHi() { return (() => 0)(); } console.log(typeof sayHi()); 정답 B // 즉시 실행함수와 typeof 연산자에 대한 문제 함수 sayHi는 즉시실행함수로 선언됐다. 값을 0을 반환하므로,.. 2024. 4. 13.
JS Quiz 29-32. 객체 / 동기-비동기 / event.target / capturing-bubbling 29. What's the output? const a = {}; const b = { key: 'b' }; const c = { key: 'c' }; a[b] = 123; a[c] = 456; console.log(a[b]); 정답 B // 다시 공부 필요 24-04-10 어떻게 정답이 나오는지 모르겠다. 아...직도 객체는... 어렵구나. 객... 체 하겠네 30. What's the output? const foo = () => console.log('First'); const bar = () => setTimeout(() => console.log('Second')); const baz = () => console.log('Third'); bar(); foo(); baz(); 정답 B // 동기 .. 2024. 4. 10.
JS Quiz 25-28. 객체의 속성 / 실행 컨텍스트 / continue / String object 25. What's the output? const obj = { a: 'one', b: 'two', a: 'three' }; console.log(obj); 정답 C // 객체의 속성을 아는지에 대한 문제 같은 프로퍼티 네임을 갖는 경우에는 프로퍼티 값이 갱신된다. 코드로 바꾸면 다음과 같다. const obj = {}; obj.a = 'one'; obj.b = 'two'; obj.a = 'three'; 26. The JavaScript global execution context creates two things for you: the global object, and the "this" keyword. 정답 A // 실행 컨텍스트에 대해 아는지에 대한 문제 맞추긴 했지만, 정확히 설명은 못 하겠다... 2024. 4. 8.
JS Quiz 21-24. eval() / ?? / var / 프로퍼티 네임 - has() 21. What's the value of sum? const sum = eval('10*10+5'); 정답 A // eval() 함수에 대해 아는지에 대한 문제 eval()은 직접 배운 적은 없지만, 유튜브 알고리즘이 나와서 보게 됐는데(마침 어제!) 쓰짐 ㅏㄹ라고 했던 함수였다. 표현식이 숫자형으로 바뀌어서 계산된다. https://youtube.com/shorts/mgdCHjJjR4M?si=-0s8Iyp9eqa2ty5O 22. How long is cool_secret accessible? sessionStorage.setItem('cool_secret', 123); 정답 B // 아직 모르겠다. 추후 공부후 업데이트 할 것이다. 23. What's the output? var num = 8; va.. 2024. 4. 6.
JS Quiz 17-20. 함수의 리턴 / 객체의 특성 / rest parameter / 엄격 모드 17. What's the output? function getPersonInfo(one, two, three) { console.log(one); console.log(two); console.log(three); } const person = 'Lydia'; const age = 21; getPersonInfo`${person} is ${age} years old`; 정답 B // 공부 필요 18. What's the output? function checkAge(data) { if (data === { age: 18 }) { console.log('You are an adult!'); } else if (data == { age: 18 }) { console.log('You are still an .. 2024. 4. 5.