JavaScript Cert Flashcards
Two main properties of an Error object thats passed as an arguement to catch in a try..catch?
Name
Message
Advantages of using Node.js ? (name three)
Asynchronous
Open Source
Non-Blocking
Valid Events when interacting with the browser?
-mousedown
-contextmenu
-keyup
describe “Modules”
-Modules can load each other
-special directives such as export and import can be used interchangeably
-a module is just a file that may contain a class or a library of functions for a specific purpose
correct syntax for accessing the property of an object in JavaScript?
The correct syntax for accessing the property of an object is:
- objectName.property
- objectName[“property”]
- objectName[expression]
name some “JavaScript Frameworks”
Angular
Node.js
React
“Falsy” values:
- 0
- null
- undefined
- NaN
- ”” or ‘’ (empty string)
- false
valid data types in JavaScript:
-null
-undefined
-Object
-Symbol
-Number
-String
-BigInt
-Boolean
correct way to look for an element by its ID
document.getElementById(‘element’);
What are the 2 most important items in your npm package.json file if you plan to publish a package?
-Name
-Version
*these 2 together establish a unique identifier for your published package
*optional if not going to publish
3 Phases of Event Propagation in standard DOM
The standard DOM Events describes 3 phases of event propagation:
Capturing phase – the event goes down to the element. (value=1)
Target phase – the event reached the target element. (value=2)
Bubbling phase – the event bubbles up from the element. (value=3)
*there is also a None phase before capturing phase (not technically event propagation though) (value=0)
how do Events in the Target Phase trigger?
will trigger all listeners on an element in the order they were registered. Hence, the outer message will be displayed first, then the inner message.
What is a “Curried Function”?
“Curried Function”: Currying is a transform that makes f(a, b, c) callable as f(a)(b)(c). The advantage of currying is that it allows us to easily get the partials. For example, we might just want to call f(a) or f(a)(b), depending on our own needs.
If a function does not return a value, its value is equal to = __________
undefined
should you ever add a “new line” between return and the value? (Y/N)
No
jQuery libarary defines a function with ______?
Lodash library defines its main function with ______?
jQuery = “$”
Lodash = “_”
3 most popular “Testing Frameworks” used by JavaScript developers?
-Puppeteer
-Mocha
-Jasmine
Describe “Mocha” Testing Framework?
-feature rich JavaScript test framework running on Node.Js and in the browser
-makes Asynchronous testing simple and fun (synchronous testing also)
Describe “Puppeteer” Testing Framework?
Node library which provides a high-level API to control headless Chrome or Chromium over the DevTools Protocol
Describe “Jasmine” Testing Framework?
Behavior Driven development framework,
for testing JavaScript code
what is JUnit ?
unit testing framework for the** Java** (not JavaScript) programming language
describe a Callback function ?
a function passed into a function to be called later
by default, the sort() function sorts values as _____?
strings
How would we sort an array in ascending order?
arr.sort((a,b) => a - b );