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 : 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
