Question: Question 1 : ES 6 Features Create a script with a function named lowerCaseWords that takes a mixed array as input. The function will do

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!