option
Cuestiones
ayuda
daypo
buscar.php

JavaScript Developer - Set 2

COMENTARIOS ESTADÍSTICAS RÉCORDS
REALIZAR TEST
Título del Test:
JavaScript Developer - Set 2

Descripción:
Set 2 JavaScript Developer

Fecha de Creación: 2026/10/08

Categoría: Arte

Número Preguntas: 64

Valoración:(0)
COMPARTE EL TEST
Nuevo ComentarioNuevo Comentario
Comentarios
NO HAY REGISTROS
Temario:

Which statement parses JSON successfully?. JSON.parse('"foo"');. JSON.parse('foo');. JSON.parse("foo");. JSON.parse('\'foo\'');.

A developer is creating a simple webpage with a button. The message gets displayed every time a user clicks the button, instead of just the first time. Which two code lines make this code work as required?. On line 04, use event.stopPropagation();. On line 02, use event.first to test if it is the first execution. On line 04, use button.removeEventListener('click', listen);. On line 06, add an option called {once: true} to button.addEventListener().

What is the value of result when Promise.race executes? (Assume car2 is fastest with 1500ms and resolves with "Car 2 completed"). Car 3 completed the race. Car 1 crashed in the race. Car 2 completed the race. Race is cancelled.

The developer has a function that prints "Hello" to an input name. What can the developer do to change the code to print "Hello World"? (sayHello takes a string, world is a function returning 'World'). Change line 7 to ()();. Change line 5 to function world() {. Change line 2 to console.log('Hello', name());. Change line 9 to sayHello(world());.

Refer to the code below: const pi = 3.1415926; What is the data type of pi?. Float. Double. Number. Decimal.

A developer has a requirement to generate SKU numbers that are always 19 characters long, starting with 'sku', and padded with zeros. let productSKU = '8675309'; Which statement assigns the correct value?. productSKU = productSKU.padEnd(16, '0').padStart('sku');. productSKU = productSKU.padStart(16, '0').padStart(19, 'sku');. productSKU = productSKU.padEnd(16, '0').padStart(19, 'sku');. productSKU = productSKU.padStart(19, '0').padStart('sku');.

Which three actions can be done using the JavaScript browser console?. Display a report showing the performance of a page. View and change the DOM of the page. Run code that is not related to the page. View and change security cookies. View, change, and debug the JavaScript code of the page.

A developer wants to use a module called DatePrettyPrint. This module exports one default function called printDate(). How can a developer import and use the printDate() function?. import printDate from '/path/DatePrettyPrint.js'; DatePrettyPrint.printDate();. import DatePrettyPrint() from '/path/DatePrettyPrint.js'; printDate();. import printDate from '/path/DatePrettyPrint.js'; printDate();. import {printDate} from '/path/DatePrettyPrint.js'; printDate();.

What is the order of the console output? console.log('Start'); Promise.resolve('Success').then(...); console.log('End');. Success Start End. End Start Success. Start Success End. Start End Success.

A developer creates a new web server that uses Node.js. It imports a server library that uses events and callbacks for handling server functionality. Which code logs an error at boot time with an event?. server.on('error', (error) => { console.log('ERROR', error); });. try { server.start(); } catch(error) { console.log('ERROR', error); }. server.error('error', (error) => { console.log('ERROR', error); });. server.catch('error', (error) => { console.log('ERROR', error); });.

Which statement accurately describes the behavior of the async/await keywords?. The associated function can only be called via asynchronous methods. The associated class contains some asynchronous functions. The associated function is asynchronous, but acts like synchronous code. The associated function sometimes returns a promise.

Which statement accurately describes an aspect of promises?. Arguments for the callback function passed to .then() are optional. In a .then() function, returning results is not necessary since callbacks will catch the result. .then() cannot be added after a catch. .then() manipulates and returns the original promise.

Which value can a developer expect when referencing country.capital.cityString? (Where city is Number("London")). undefined. 'London'. An error. NaN.

What are the values of objBook and newObjBook respectively after Object.preventExtensions(objBook) and newObjBook.author = 'Robert'?. {author: "Robert"} {author: "Robert", title: "JavaScript"}. {author: "Robert", title: "JavaScript"} undefined. {author: "Robert", title: "JavaScript"} {author: "Robert", title: "JavaScript"}. {title: "JavaScript"} {title: "JavaScript"}.

The developer needs to insert a code statement that does not require an import, logs an error when the Boolean statement evaluates to false, and works in both the browser and Node.js. console.debug(number % 2 === 0);. console.assert(number % 2 === 0);. console.error(number % 2 === 0);. assert(number % 2 === 0);.

Given the following code: let x = ('15' + 10) * 2; What is the value of x?. 1520. 50. 35. 3020.

Given the requirement to refactor the code above to JavaScript class format, which class definition is correct?. class Vehicle { constructor(name, price) { this.name = name; this.price = price; } priceInfo() { return `Cost of the ${this.name} is ${this.price}`; } }. class Vehicle { vehicle(name, price) { this.name = name; this.price = price; } priceInfo() { return `Cost of the ${this.name} is ${this.price}`; } }. class Vehicle { constructor() { this.name = name; this.price = price; } priceInfo() { return `Cost of the ${this.name} is ${this.price}`; } }. class Vehicle { constructor(name, price) { this.name = name; this.price = price; } function priceInfo() { return `Cost...`; } }.

Which option is true about the strict mode in imported modules?. Add the statement use strict = false; before any other statements in the module to enable not-strict mode. Imported modules are in strict mode whether you declare them as such or not. A developer can only reference notStrict() functions from the imported module. Add the statement use non-strict; before any other statements in the module to enable not-strict mode.

A developer wants to set up a secure web server with Node.js. Without using any third-party libraries, what should the developer add to index.js to create the secure web server?. const http = require('http');. const tls = require('tls');. const server = require('secure-server');. const https = require('https');.

Given the code below: const copy = JSON.stringify([new String('false'), new Boolean(false), undefined]); What is the value of copy?. '[false, {}]'. '["false", false, undefined]'. '["false", false, null]'. '["false", {}]'.

What are two unique features of functions defined with a fat arrow as compared to normal function definition?. The function receives an argument that is always in scope, called parentThis. The function uses the this from the enclosing scope. If the function has a single expression in the function body, the expression will be evaluated and implicitly returned. The function generates its own this making it useful for separating the function's scope.

What should a developer insert at line 15 to output the following message using the load method? > SNEGeneziz is loading a cartridge game: Super Monic 3x Force... Console16bit.prototype.load(gamename) = function() {. Console16bit.prototype.load = function() {. Console16bit.prototype.load(gamename) {. Console16bit.prototype.load = function(gamename) {.

Which command can the developer use to open the CLI debugger in their current terminal window?. node -i server.js. node start inspect server.js. node inspect server.js. node server.js --inspect.

What value can a developer expect when referencing o.js.secondCity? (Where city2 = String('New York') and returns secondCity: city2.toLowerCase()). undefined. 'New York'. An error (TypeError because o.js is accessed but getter executes without returning an object with .secondCity natively in some contexts, wait, getter returns the object, but here the property is evaluated dynamically... wait, the getter returns the object directly, so o.js.secondCity evaluates to 'new york' if properly defined. Actually, if there is a syntax error in the prompt's snippet, it's an error. The official answer is "An error" due to the function syntax). 'new york'.

Refer to the HTML below: <p> The current status of an Order: <span id="status"> In Progress </span> </p> Which JavaScript statement changes the text 'In Progress' to 'Completed'?. document.getElementById("status").innerHTML = 'Completed';. document.getElementById(".status").innerHTML = 'Completed';. document.getElementById("status").Value = 'Completed';. document.querySelector("#status").value = 'Completed';.

What is the value of result after the code executes? function changeValue(obj) { obj.value = obj.value / 2; } const objA = {value: 10}; const objB = objA; changeValue(objB);. 10. 5. NaN. undefined.

Which code should replace the placeholder comment on line 05 to hide accounts that do not match the search string? account.style.display = accountName.includes(parsedSearchString) ? /* Insert code here */ : '';. 'none' : 'block'. 'block' : 'none'. 'visible' : 'hidden'. 'hidden' : 'visible'.

What is the value of array after the code executes? array.splice(i, 1); i--; on array [1, 2, 3, 4, 4, 5, 4, 4] where array[i] == 4. [1, 2, 3, 4, 5, 4, 4]. [1, 2, 3, 4, 4, 5, 4]. [1, 2, 3, 4, 5, 4]. [1, 2, 3, 5].

A developer has an isDog function that takes one argument, pet. They want to schedule the function to run every minute. What is the correct syntax for scheduling this function?. setInterval(isDog('cat'), 60000);. setTimeout(isDog, 60000, 'cat');. setTimeout(isDog('cat'), 60000);. setInterval(isDog, 60000, 'cat');.

A developer wants to use a try...catch statement to catch any error that countSheep() may throw and pass it to a handleError() function. What is the correct implementation?. try { setTimeout(function() { countSheep(); }, 1000); } catch(e) { handleError(e); }. setTimeout(function() { try { countSheep(); } catch(e) { handleError(e); } }, 1000);. try { countSheep(); } finally { handleError(e); }. try { countSheep(); } handleError(e) { catch(e); }.

Which two functions can replace line 01 and return 58 to sum? const addBy = ?; const addByEight = addBy(8); const sum = addByEight(50);. const addBy = function(num1) { return function(num2) { return num1 + num2; } }. const addBy = (num1) => num1 + num2;. const addBy = function(num1) { return num1 * num2; }. const addBy = (num1) => (num2) => num1 + num2;.

Where can the developer see the log statement after loading the page in the browser? console.log("Page has loaded!");. On the browser JavaScript console. On the terminal console running the web server. On the webpage console log. In the browser performance tools log.

Which two assert statements are valid tests for this function? sum3 function that sums the first three elements. console.assert(sum3(['hello', 2, 3, 4]) === NaN);. console.assert(sum3([-3, 2]) === -1);. console.assert(sum3([1, '2']) == 12);. console.assert(sum3([]) === 0);.

Which two statements could be inserted at line 17 to enable the function call on line 18? leo.roar();. Object.assign(leo, Tiger);. leo.roar = () => { console.log('They\'re pretty good!'); };. leo.prototype.roar = () => { console.log('They\'re pretty good!'); };. Object.assign(leo, tony);.

Which two statements result in the array [1, 2, 3, 4, 5] from let inArray = [[1,2], [3,4,5]];?. [].concat([inArray]);. [].concat.apply(inArray, []);. [].concat.apply([], inArray);. [].concat(...inArray);.

What is the result when the Promise in the execute function is rejected? promise.catch(() => console.log('Rejected')).then(() => console.log('Resolved4'));. Resolved1 Resolved2 Resolved3 Resolved4. Resolved1 Resolved2 Resolved3 Rejected Resolved4. Rejected Resolved4. Rejected.

What is the output when executing the code above? (SaleItem extending Item, overriding prototype.description). This is a Scarf / Uncaught TypeError / This is a Shirt / This is a discounted Shirt. This is a Scarf / This is a Shirt / This is a Scarf / This is a discounted Shirt. This is a Scarf / This is a Shirt / This is a discounted Scarf / This is a discounted Shirt. This is a Scarf / Uncaught TypeError / This is a Scarf / This is a discounted Shirt.

A developer removes the HTML class attribute from the checkout button, so now it is simply <button>Checkout</button>. There is a test to verify the existence of the checkout button, however it looks for a button with class="blue". The test fails because no such button is found. Which type of test category describes this test?. False positive. True positive. False negative. True negative.

Based on the code, what must be true about the printPrice function of the PricePrettyPrint module for this import to work? import printPrice from '/path/PricePrettyPrint.js';. printPrice must be a named export. printPrice must be an all export. printPrice must be the default export. printPrice must be a multi export.

Considering that JavaScript is single-threaded, what is the output of line 08 after the code executes? total = 10; setInterval(()=>{total++; clearInterval(interval); total++;}, 0); total++; console.log(total);. 10. 13. 12. 11.

Given a value, which three options can a developer use to detect if the value is NaN?. Number.isNaN(value). value == NaN. Object.is(value, NaN). value === Number.NaN. value !== value.

After user acceptance testing, the developer is asked to change the webpage background based on user's location. The tester reports that the background is not changing, however it works as required when viewing on the developer's computer. Which two actions will help determine accurate results?. The tester should clear their browser cache. The developer should rework the code. The developer should inspect their browser refresh settings. The tester should disable their browser cache.

Which statement should be inserted in the placeholder on line 02 to allow for a variable to be set to a new instance of a story with the three attributes correctly populated?. constructor() {. super(body, author, viewCount) {. constructor(body, author, viewCount) {. function Story(body, author, viewCount) {.

Refer to the string below: const str = 'Salesforce'; Which two statements result in the word 'Sales'?. str.substr(1, 5);. str.substring(1, 5);. str.slice(0, 5);. str.substring(0, 5);.

Given the following code: let x = null; console.log(typeof x); What is the output of line 02?. "null". "undefined". "x". "object".

To ensure that visitors have a good experience, a script named personalizeWebsiteContent needs to be executed when the webpage is fully loaded (HTML content and all related files), in order to do some custom initializations. Which implementation should be used?. Add a listener to the window object to handle the DOMContentLoaded event. Add a handler to the personalizeWebsiteContent script to handle the DOMContentLoaded event. Add a listener to the window object to handle the load event. Add a handler to the personalizeWebsiteContent script to handle the load event.

A developer uses a client that makes a GET request that uses a Promise to handle the request. getRequest returns a Promise. Which code modification can the developer make to gracefully handle an error?. Wrap in try...catch without async. requestPromise().then((response) => { handleResponse(response); }).catch((error) => { handleError(error); });. requestPromise().then(...).finally(...). try { requestPromise().then(...) } catch(e) {}.

Given the requirement to refactor the code above to JavaScript class format, which class definition is correct?. class Vehicle { vehicle(name, price) { ... } }. class Vehicle { constructor(name, price) { this.name = name; this.price = price; } priceInfo() { return `Cost...`; } }. class Vehicle { constructor() { ... } }. class Vehicle { constructor(name, price) { ... } function priceInfo() { ... } }.

Which two statements correctly execute the runParallel() function?. runParallel().then(function(data) { return data; });. runParallel().done(function(data) { return data; });. async runParallel().then(data);. runParallel().then(data => console.log(data));.

In lines 04 and 08, which code allows the user to select an image from their local computer, and to display the image in the browser?. const reader = new File(); if (file) URL.createObjectURL(file);. const reader = new FileReader(); if (file) reader.readAsDataURL(file);. const reader = new FileReader(); if (file) URL.createObjectURL(file);. const reader = new File(); if (file) reader.readAsDataURL(file);.

Which code executes sayHello once, two minutes from now?. setTimeout(sayHello(), 120000);. delay(sayHello, 120000);. setInterval(sayHello, 120000);. setTimeout(sayHello, 120000);.

A developer tries to retrieve all cookies, then sets a certain key value pair in the cookie: document.cookie; document.cookie = 'key=John Smith'; What is the behavior?. Cookies are not read because line 01 should be document.cookies, but the key value is set and all cookies are wiped. Cookies are read and the key value is set, the remaining cookies are unaffected. Cookies are read, but the key value is not set because the value is not URL encoded. Cookies are read and the key value is set, and all cookies are wiped.

A developer is leading the creation of a new browser application that will serve a single page application. The team wants to use a new web framework Minimalist.js. The lead developer wants to advocate for a more seasoned web framework/library that already has a community around it. Which two frameworks/libraries should the lead developer advocate for?. React. Koa. Vue. Express.

When the user clicks the button, the output is always "Hello". What needs to be done to make this code work as expected?. Replace line 02 with button.addCallback("click", function() {. Replace line 03 with const input = document.getElementByName('input');. Replace line 04 with console.log(input.value);. Replace line 02 with button.addEventListener("onclick", function() {.

A team at Universal Containers works on a big project and use yarn to deal with the project's dependencies. A developer added a dependency to manipulate dates and pushed the updates to the remote repository. The rest of the team complains that the dependency does not get downloaded when they execute yarn. What could be the reason for this?. The developer missed the option --add when adding the dependency. The developer added the dependency as a dev dependency, and YARN_ENV is set to production. The developer added the dependency as a dev dependency, and NODE_ENV is set to production. The developer missed the option --save when adding the dependency.

What is displayed when myFunction(true) is called? (let x = 1; var y = 1; if(true){ let x = 2; var y = 2; ... }). 2 2 1 1. 2 2 undefined undefined. 2 2 2 2. 2 2 1 2.

All the elements include the same ad-library-item class. They are hidden by default, and they are randomly displayed while the user navigates through the page. Tired of all the ads, what can the developer do to temporarily and quickly remove them?. Use the DOM inspector to prevent the load event to be fired. Use the browser console to execute a script that prevents the load event to be fired. Use the browser console to execute a script that removes all the elements containing the class ad-library-item. Use the DOM inspector to remove all the elements containing the class ad-library-item.

What should a developer insert at line 15 to output the following message using the load method? > SNEGeneziz is loading a cartridge game: Super Monic 3x Force... Console16bit.prototype.load(gamename) = function() {. Console16bit.prototype.load(gamename) {. Console16bit = Object.create(GameConsole.prototype).load = function(gamename) {. Console16bit.prototype.load = function(gamename) {.

What are two unique features of functions defined with a fat arrow as compared to normal function definition?. If the function has a single expression in the function body, the expression will be evaluated and implicitly returned. The function uses the this from the enclosing scope. The function receives an argument that is always in scope, called parentThis, which is the enclosing lexical scope. The function generates its own this making it useful for separating the function's scope from its enclosing scope.

A developer has two ways to write a function: Option A: `this.growl = () => {}` inside constructor. Option B: `Monster.prototype.growl = () => {}`. After creating 1000 monster objects, how many growl methods are created with Option A and Option B?. 1000 growl methods are created regardless of which option is used. 1 growl method is created regardless of which option is used. 1000 growl methods are created for Option A. 1 growl method is created for Option B. 1 growl method is created for Option A. 1000 growl methods are created for Option B.

Which two statements result in the array [1, 2, 3, 4, 5] from let inArray = [[1,2], [3,4,5]];?. [].concat([inArray]);. [].concat.apply([], inArray);. [].concat(...inArray);. [].concat([...inArray]);.

What happens due to the lack of the new keyword on line 02? `const m = Monster();` (where Monster sets `this.name = 'hello'`). window.m is assigned the correct object. The m variable is assigned the correct object but this.name remains undefined. The m variable is assigned the correct object. window.name is assigned to 'hello' and the variable m remains undefined.

A developer needs to debug a Node.js web server because a runtime error keeps occurring at one of the endpoints. The developer wants to debug the Node.js server only using the terminal. Which command can the developer use to open the CLI debugger in their current terminal window?. node start inspect server.js. node -i server.js. node inspect server.js. node server.js --inspect.

Given the code below: `const copy = JSON.stringify([new String('false'), new Boolean(false), undefined]);` What is the value of copy?. '[false, {}]'. '["false", false, undefined]'. '["false", false, null]'. '["false", {}]'.

Denunciar Test