jirafa 1
|
|
Título del Test:
![]() jirafa 1 Descripción: preguntas nuevas |



| Comentarios |
|---|
NO HAY REGISTROS |
|
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 added the dependency as a dev dependency, and YARN ENV Is set to production. The developer missed the option --save when adding the dependency. The developer added the dependency as a dev dependency, and NODE ENV is set to production. The developer missed the option --add when adding the dependency. let o= { get js() { let city1 = String('St. Louis'); let city2 = String('New York'); return { firstCity: city1.toLowerCase(), secondCity: city2.toLowerCase(), } } } What value can a developer expect when referencing o.js.secondCity?. undefined. An error. 'New York'. 'new york'. Refer to the code below: 01 x = 3.14; 02 03 function myFunction() { 04 'use strict'; 05 y= x; 06 } 07 08 z= x; 09 myFunction (); Considering the implications of 'use strict' on line 04, which three statements describe the execution of the code?. 'use strict' is hoisted, so it has an effect on all lines. z is equal to 3.14. 'use strict' has an effect between line 04 and the end of the file. 'use strict' has an effect only on line 05. Line 05 throws an error. Refer to the code below: 01 let total = 10; 02 const interval = setInterval(() => { 03 total++; 04 clearInterval(interval); 05 total++; 06 }, 0); 07 total++; 08 console.log(total); Considering that JavaScript is single-threaded, what is the output of line 08 after the code executes?. 11. 12. 10. 13. Refer to the code below: 01 const objBook = { 02 title: 'JavaScript', 03 }; 04 Object.preventExtensions(objBook); 05 const newObjBook = objBook; 06 newObjBook.author = 'Robert'; What are the values of objBook and newObjBook respectively?. { title: "JavaScript" } { title: "JavaScript" }. { author: "Robert", title: "JavaScript" } undefined. { author: "Robert" } { author: "Robert", title: "JavaScript" }. { author: "Robert", title: "JavaScript" } { author: "Robert", title: "JavaScript" }. A developer creates a simple webpage with an input field. When a user enters text in the input field and clicks the button, the actual value of the field must be displayed in the console. Here is the HTML file content: <input type="text" value="Hello" name="input"> <button type="button">Display</button> The developer wrote the JavaScript code below: 01 const button = document.querySelector('button'); 02 button.addEventListener('click', () => { 03 const input = document.querySelector('input'); 04 console.log(input.getAttribute('value')); 05 }); 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 developer at Universal Containers is creating their new landing page based on HTML, CSS, and JavaScript. 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 to call personalizeWebsiteContent based on the business requirement above?. 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 listener to the window object to handle the DOMContentLoaded event. Add a handler to the personalizeWebsiteContent script to handle the load event. 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, 60000, 'cat');. setInterval(isDog('cat'), 60000);. setTimeout(isDog('cat'), 60000);. setTimeout(isDog, 60000, 'cat');. A developer wants to create a simple image upload in the browser using the File API. The HTML is below: <input type="file" onchange="previewFile()"> <img src="" height="200" alt="Image preview..." /> The JavaScript portion is: 01 function previewFile() { 02 const preview = document.querySelector('img'); 03 const file = document.querySelector('input[type=file]').files[0]; 04 // line 4 code 05 reader.addEventListener("load", () => { 06 preview.src = reader.result; 07 }, false); 08 // line 8 code 09 } 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?. 04 const reader = new File(); 08 if (file) reader.readAsDataURL(file);. 04 const reader = new FileReader(); 08 if (file) reader.readAsDataURL(file);. 04 const reader = new FileReader(); 08 if (file) URL.createObjectURL(file);. Given a value, which three options can a developer use to detect if the value is NaN?. Number.isNaN(value). Object.is(value, NaN). value === Number.NaN. value !== value. value == NaN. Refer to the code below: 01 const exec = (item, delay) => 02 new Promise(resolve => setTimeout(() => resolve(item), delay)); 03 04 async function runParallel() { 05 const [result1, result2, result3] = await Promise.all( 06 [exec('x', '100'), exec('y', '500'), exec('z', '100')] 07 ); 08 return `parallel is done: ${result1}${result2}${result3}`; 09 } Which two statements correctly execute the runParallel() function?. async runParallel().then(data);. runParallel().then(function(data){ return data; });. runParallel().done(function(data){ return data; });. runParallel().then(data);. 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. Refer to the code below: 01 let car1 = new Promise((_, reject) => 02 setTimeout(reject, 2000, "Car 1 crashed in")); 03 let car2 = new Promise(resolve => setTimeout(resolve, 1500, "Car 2 completed")); 04 let car3 = new Promise(resolve => setTimeout(resolve, 3000, "Car 3 completed")); 05 06 Promise.race([car1, car2, car3]) 07 .then(value => { 08 let result = `${value} the race.`; 09 }) 10 .catch(err => { 11 console.log("Race is cancelled.", err); 12 }); What is the value of result when Promise.race executes?. Car 2 completed the race. Car 3 completed the race. Race is cancelled. Car 1 crashed in the race. Refer to the code below: 01 function Tiger() { 02 this.type = 'Cat'; 03 this.size = 'large'; 04 } 05 06 let tony = new Tiger(); 07 tony.roar = () => { 08 console.log('They\'re great!'); 09 }; 10 11 function Lion() { 12 this.type = 'Cat'; 13 this.size = 'large'; 14 } 15 16 let leo = new Lion(); 17 // Insert code here 18 leo.roar(); Which two statements could be inserted at line 17 to enable the function call on line 18?. leo.roar = () => { console.log('They\'re pretty good!'); };. Object.assign(leo, tony);. Object.assign(leo, Tiger);. leo.prototype.roar = () => { console.log('They\'re pretty good!'); };. 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 of the try...catch?. try { setTimeout(function() { countSheep(); }, 1000); } catch (e) { handleError(e); }. try { countSheep(); } finally { handleError(e); }. try { countSheep(); } handleError (e) { catch(e); }. setTimeout(function() { try { countSheep(); } catch (e) { handleError(e); } }, 1000);. Refer to the code snippet: 01 let array = [1, 2, 3, 4, 4, 5, 4, 4]; 02 for (let i = 0; i < array.length; i++) { 03 if (array[i] === 4) { 04 array.splice(i, 1); 05 i--; 06 } 07 } What is the value of array after the code executes?. [1, 2, 3, 4, 5, 4]. [1, 2, 3, 5]. [1, 2, 3, 4, 5, 4, 4]. [1, 2, 3, 4, 4, 5, 4]. Given the following code: let x = ('15' + 10) * 2; What is the value of x?. 1520. 50. 35. 3020. A developer wants to set up a secure web server with Node.js. The developer creates a directory locally called app-server, and the first file is app-server/index.js. Without using any third-party libraries, what should the developer add to index.js to create the secure web server?. const server = require('secure-server');. const tls = require('tls');. const http = require('http');. const https = require('https');. Refer to the code below: 01 const event = new CustomEvent( 02 // Missing code 03 ); 04 obj.dispatchEvent(event); A developer 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?. 'update', { recordId: '123abc' }. { type: 'update', recordId: '123abc' }. 'update', { detail: { recordId: '123abc' } }. 'update', '123abc'. |




