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 (ES6) 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)
1. Folder Structure and Code Organization
Create a folder for your work to ensure you dont pollute the global
namespace.
o Example: studentid_comp3123_labtest1/
Create separate files/modules inside the folder if needed to avoid
overwriting code.
2. Documentation Resources
JavaScript ES6 Documentation: MDN JavaScript Docs
Node.js Documentation: Node.js Docs
Question 1: ES6 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 non-strings and lower case the remaining words
Input
const mixedArray =['PIZZA',10, true, 25, false, 'wings']
Output
Output [ 'pizza', 'wings']
Question 2: 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 500ms.
o Create a method rejectedPromise that is similar to
delayedException and rejects an error message after a timeout of
500ms.
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.log(success);
},500);
};
const delayedException =()=>{
setTimeout(()=>{
try {
throw new Error('error: delayed exception!');
} catch (e){
console.error(e);
}
},500);
};
delayedSuccess();
delayedException();
Output
{ message: 'delayed success!'}
{ error: 'delayed exception!'}
Question 3: File Module
Create a script that will do the following:
1. 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
2. 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 10 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
loge.txt log1.txt log2.txt log3.txt log4.txt log5.txt log6.txt log7.txt log8.txt log9.txt
delete files...loge. txt delete files...log1.txt delete files...log2.txt delete files...log3.txt delete files...log4. txt delete files...log5. txt delete files...log6.txt delete files ...log7.txt delete files...log8.txt delete files ...log9.txt

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!