본문 바로가기

salesforce certification

(6/60) Refer to the code below:for(let number =2 ; number <= 5 ; number += 1 ) {// insert code statement here}The developer needs to insert a code statement in the location shown. The codestatement has these requirements:1. Does require an import2. Logs..

Refer to the code below:

for ( let number=2 ; number<= 5 ; number += 1 ) {
// insert code statement here
//console.error(number % 2 === 0);
//console.debug(number % 2 === 0);
//assert(number % 2 === 0);
console.assert(number % 2 === 0);
}

The developer needs to insert a code statement in the location shown. The code
statement has these requirements:
1. Does require an import
2. Logs an error when the boolean statement evaluates to false
3. Works in both the browser and Node.js
Which meet the requirements?

console.error(number % 2 === 0);
console.debug(number % 2 === 0);
: 컴파일러에서는 결과 똑같이 나오지만, 브라우저 개발자 도구에서 테스트 해보면 debug는 출력 되지 않음.

console.assert
: 표현식이 FALSE일 때만, console에 결과 출력

https://onecompiler.com/javascript/3yncacrh9

 

3yncacrh9 - JavaScript - OneCompiler

Javascript Online Compiler Write, Run & Share Javascript code online using OneCompiler's JS online compiler for free. It's one of the robust, feature-rich online compilers for Javascript language. Getting started with the OneCompiler's Javascript editor is

onecompiler.com