Exercise: Check Your Directory
Exercise on finding if certain files exist in your directory using JavaScript asynchronously
We'll cover the following
Task
A software developer is struggling to organize the files in her directory. She keeps finding errors related to files not in her directory. She knows that JavaScript can solve this problem asynchronously, but doesn’t know how to implement the solution. She asked you to write code that tells if a list of files exists in the current directory.
Problem statement
Your task is to write an async function finder
. It will take an array of file names (filenames
) in the form of a string and return a two-dimensional array where each inner array has the following values at each index.
-
Index 0: file name in the form of string
-
Index 1: boolean value where
true
value means the file does exist andfalse
value means the file does not
A sample directory is below.
Get hands-on with 1400+ tech skills courses.