Set 2-2

A vibrant illustration of a developer sitting at a computer, deep in thought with JavaScript code on the screen, surrounded by code-related icons and symbols.

JavaScript Skills Challenge

Test your knowledge and skills in JavaScript with our engaging quiz designed for developers of all levels. From arrow functions to error handling, challenge yourself with 10 carefully crafted questions that cover essential JavaScript concepts.

  • Multiple choice and checkbox questions
  • Real-world programming scenarios
  • Great way to assess your coding proficiency
10 Questions2 MinutesCreated by CodingNinja475
A developer has the following array of hourly wages:
 
let arr = [8.5, 9.75, 11.25, 7.75, 13.25];
 
For workers making less than $10 an hour, their rate should be multiplied by 1.25 and returned in a new array.
 
How should the developer implement the request?
Let arr1 = arr.filter((val) => val < 10).map((num) => num * 1.25);
Let arr1 = arr.mapArray((val) => { val < 10 }).map((num) => { num * 1.25 });
Let arr1 = arr.map((num) => { return num * 1.25 }).filter((val) => { return val < 10 });
Let arr1 = arr.filterBy((val) => val < 10).mapBy((num) => num * 1.25);
Which three options show valid methods for creating a fat arrow function?
X, y, z => { console.log('executed'); }
[] => { console.log('executed'); }
X => { console.log('executed'); }
(x, y, z) => { console.log('executed'); }
() => { console.log('executed'); }
Given a value, which two options can a developer use to detect if the value is NaN?
IsNaN(value)
Object.is(value, NaN)
Value === Number.NaN
Value == NaN
Given the following code, what is the value of x?
 
let x = '15' + (10 * 2);
35
50
1520
3020
Refer to the code below:
 
01 const event = new CustomEvent (
02     // Missing code
03 );
04 obj.dispatchEvent(event);
 
A developr needs to dispatch a custom event called update to send information about recordId.
 
Which two options could a developer insert at the placeholder in line 02 to achieve this?
 
Choose 2 answers
'update', {
    detail : {
         recordId :  '123abc'
    }
}
'update', {
    recordId :  '123abc'
}
{type : 'update', recordId : '123abc'}
'update', '123abc'
The developer wants to test the array shown:
 
const arr = Array(5).fill(0);
 
Which two tests are the most accurate for this array?
Console.assert(arr[0] === 0 && arr[arr.length] === 0);
Arr.forEach(elem => console.assert(elem === 0));
Console.assert(arr.length === 5);
Console.assert(arr.length > 0);
A developer is debugging a web server that uses Node.js. The server hits a runtime error every third request to an important endpoint on the web server.
 
The developer added a break point to the start script, that is at index.js at the root of the server's source code.
The developer wants to make use of Chrome DevTools to debug.
 
Which command can be run to access DevTools and make sure the breakpoint is hit?
Node --inspect-brk index.js
Node --inspect index.js
Node - index.js
Node inspect index.js
Which option is true about the strict mode in imported modules?
Imported modules are in strict mode whether you declare them as such or not.
Add the statement use strict = false; before any other statements in the module to enable not-strict mode.
Add the statement use non-strict; before any other statements in the module to enable not-strict mode.
A developer can only reference notStrict() functions from the imported module.
A developer creates a generic function to log custom message in the console. To do this, the function below is implemented.
 
01 function logStatus(status) {
02     console./*Answer goes here*/('Item status is: %s', status);
03 }
 
Which three console logging methods allow the use of string substitution in line 02?
 
Choose 3 answers
Message
Assert
Info
Log
Error
A developer is trying to handle an error within a function.
 
Which code segment shows the correct approach to handle an error without propagating it elsewhere?
try {
    doSomething();
} catch (error) {
    throw new Error('Error found');
}
try {
    doSomething();
} catch (error) {
    return error;
}
try {
    doSomething();
} catch (error) {
    throw null;
}
try {
    doSomething();
} catch (error) {
    processError(error);
}
{"name":"Set 2-2", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Test your knowledge and skills in JavaScript with our engaging quiz designed for developers of all levels. From arrow functions to error handling, challenge yourself with 10 carefully crafted questions that cover essential JavaScript concepts.Multiple choice and checkbox questionsReal-world programming scenariosGreat way to assess your coding proficiency","img":"https:/images/course1.png"}
Powered by: Quiz Maker