Question: Full stack Development I Instructions for a lab test submission involving JavaScript ( ES 6 ) and Node.js . Here s a quick checklist and
Full stack Development I
Instructions for a lab test submission involving JavaScript ES and Node.js
Heres a quick checklist and guide for completing your lab test and submission:
Developer Note:
When working on your questions, please create separate folder for your
work. This way you wont be putting all your code in the same file, which can
pollute the global namespace. In short, it will prevent you from overwriting your
own work and causing your code to compile incorrectly.
Organize your folder structure in this way Use it as a reference
Folder Structure and Code Organization
Create a folder for your work to ensure you dont pollute the global
namespace.
o Example: studentidcomplabtest
Create separate filesmodules inside the folder if needed to avoid
overwriting code.
Documentation Resources
JavaScript ES Documentation: MDN JavaScript Docs
Node.js Documentation: Node.js Docs
Question : ES Features
Create a script with a function named lowerCaseWords that takes a
mixed array as input.
The function will do the following.
o return a promise that is resolved or rejected
o filter the nonstrings and lower case the remaining words
Input
const mixedArray PIZZA true, false, 'wings'
Output
Output 'pizza', 'wings'
Question : Promises
Given the script file callbacks.js write a script that does the following:
o Create a method resolvedPromise that is similar to
delayedSuccess and resolves a message after a timeout of ms
o Create a method rejectedPromise that is similar to
delayedException and rejects an error message after a timeout of
ms
o Call both promises separately and handle the resolved and reject
results and then output to the console
callbacks.js
const delayedSuccess
setTimeout
let success 'message': 'delayed success!;
console.logsuccess;
;
;
const delayedException
setTimeout
try
throw new Errorerror: delayed exception!;
catch e
console.errore;
;
;
delayedSuccess;
delayedException;
Output
message: 'delayed success!
error: 'delayed exception!
Question : File Module
Create a script that will do the following:
Remove Log files
o remove all the files from the Logs directory, if exists
o output the file names to delete
o remove the Logs directory
Create Log files
o create a Logs directory, if it does not exist
o change the current process to the new Logs directory
o create log files and write some text into the file
o output the files names to console
o Hint: use the fs module and path module, and the process current
working directory to build directory path. It is acceptable, to have a
remove.js script and separate add.js script.
Output
logetxt logtxt logtxt logtxt logtxt logtxt logtxt logtxt logtxt logtxt
delete files...loge txt delete files...logtxt delete files...logtxt delete files...logtxt delete files...log txt delete files...log txt delete files...logtxt delete files logtxt delete files...logtxt delete files logtxt
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
