function makeLastSeenMsg(name, period) {
const day = 60 * 24;
const hour = 60;
if (period >= day) {
return `${name}: ${Math.floor(period / day)}일 전에 접속함`;
} else if (period >= hour) {
return `${name}: ${Math.floor(period / hour)}시간 전에 접속함`;
} else {
return `${name}: ${period}분 전에 접속함`;
}
}코드를 입력하세요
위에서 const는 무엇인가?
function makeMultiplesOfDigit(num) {
let result = '' ;
for (let i = 1 ; i <= num ; i++) {
if (i % 3 === 0) {
result = result + String(i)
}
}
return result;
}
```
위에서 3의 배수를 구하는 if문을 제거하고 i++ 부분을 i += 3으로 바꿈
``` js
function makeMultiplesOfDigit(num) {
let result = '' ;
for (let i = 1 ; i <= num ; i += 3 ) {
result = result + String(i)
}
return result;
}
시간 복잡도는 T(n)과 같이 표기합니다. 이 표기법은 어떤 알고리즘이 n 크기의 입력량을 처리하는 데 수행되는 연산의 횟수를 나타냅니다. T(n)을 알고리즘의 실행 비용이라고 생각할 수도 있습니다.
max-width: 100vw;
height: 100vh;
AC 버튼이 사용되는 모든 변수를 초기화시키고 있나요? 화면은 0이 나오고 있나요?
const display = window.document.querySelector('.calculator__display');
display.textContent = 'Something strange';
const clearButton = window.document.querySelector('.clear');
clearButton.dispatchEvent(clickEvent);
expect(window.firstNum).to.be.undefined;
expect(window.operator).to.be.undefined;
expect(display.textContent).to.equal('0');
done();
문제의 위 요구사항에서 막혀서 알게 된 사실. if(clear) 구문에서 네 가지 변수들을 ''로 할당했던 것을 display 빼고 undefined로 하니 해결되었다.
한 권으로 그리는 컴퓨터과학 로드맵(2018) / 블라드스톤 페헤이라 필루
https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/undefined
https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/null
https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/NaN