Quiz 2 Flashcards
What is a promise?
An object that will be completed in the future
In a JavaScript class, how do you declare a getter function for a field called “stuff” so that the function can be called on an instance, obj, by writing “obj.stuff”?
get stuff
Suppose you call a function that requires a callback with two parameters, err and data. When the callback completes, which of the following possibilities should NOT occur?
Err and data are both populated – indicating that the function encountered an error but still was able to return some of the data
What is the name of the tool that creates HTML pages from JavaScript comments?
Jsdoc
In a JavaScript class, where should the “exports” object be declared?
After the class body
What is the node command to install the dependencies listed in the package.json file?
Npm install
The keyword await is used to?
Wait for a Promise to resolve
When a Promise resolves, it is in one of two possible states. Those two states are called?
Fulfilled / rejected
What will happen if you call a function that returns a Promise and you forget to use await?
The program will hang indefinitely
In a JavaScript class, how do you declare a field called “stuff” so that it is private?
stuff