Chapter project
Password checker
Using an array of allowed passwords, this exercise will create an application to check if one of these password string values exists in an array that lists all the accepted passwords. Set a Promise to check if the password is valid, and upon the result either resolve with the status of true or reject with the status of false. Return the check results.
- Create an array of allowed passwords.
- Create a login function that will check if the argument is a value that is included in the passwords array. You can use
indexof()
or theincludes()
method to check the array for a value and return a Boolean value of the result.The
includes()
method is an array method that can check whether a certain value is included among the items in the array. It will return a Boolean value depending on the result. - Add a function that returns a Promise. Using
resolve
andreject
, return a JavaScript object with the Boolean...