Javascript Final Flashcards
What does ECMA stand for?
European Computer Manufacturer’s Association
What is ECMA?
ECMA is a trademarked scripting-language specification standardized by ECMA international
What is ECMA used for?
For client-side scripting and for writing server applications and services using Node.js
What is a Shim?
A software add-in that provides full support for a particular software standard
What are some examples of ECMAScript?
The “use strict” directive, for example String.trim(), Array.isArray(), Array.indexOf(), JSON.parse(), JSON.stringify(), property getters and setters and new object property methods
What is a part of ECMA6?
Support for constants, Block Scope, Arrow Functions, Template literals, Modules, Classes, Promises etc…
What are sets (set collections)?
Ordered lists of values that contain no duplicates. Accessed using keys
What are maps?
the map object holds key-value pairs. Any value (both objects and primitive
values) may be used as either a key or a
value
What are classes?
provides syntactical sugar. They offer a cleaner and more elegant syntax.
Getters and setters
Properties are nouns, methods are verbs
Inheritance
Concepts at higher levels are more general, concepts at lower levels are more specific(inherit properties of concepts at higher levels)
Arrow Functions
Shorter way of creating simple functions, called lambdas in other languages.
Are arrow functions named?
Arrow functions are not named, they can be assigned to a variable but are always anonymous
Arrow function syntax
has a set of parentheses that will hold all the parameters like a function expression, next is the arrow =>, then the curly braces {} that will have the body of the function inside. Parentheses are optional only when one parameter is being passed. if no parameters are being passed, parentheses are required
Example for a function
function literal (declaration)
function add1(a, b) {
return a + b;
}
Example for function expression
let add2 = function (a, b) {
return a + b;
};
Example for arrow function
let add3 = (a, b) => {return a + b;}
Invocation of functions
Invoking a function suspends the execution of the current function, passing control and parameters to the new function. When the function is finished, it returns to the line following where it was invoked. It remembers where to return to because this information is stored on the stack prior to the function being invoked
Return
the return statement can be used to cause the function to return early. A function always returns a value. If the value is not specified then undefined is returned
Scope
controls the visibility and lifetimes of variables and parameters
Scope variables
Variables and objects that are currently referenced are known as “alive”, deleted or moved out of scope or method finishes are de-referenced (no longer alive)
Closure
the local variables for a function - kept alive after the function has returned
Closure(cont)
Whenever you use a function inside another function, a closure is created. A closure in js is like keeping a copy of all the local variables, just as they were when a function exited
What is Node.js
A platform for executing JavaScript base on non-blocking I/O. Uses an event driven model that enables fast scalable network applications
Node.js(cont)
its a sever-side javascript for network applications. Supports modular JavaScript, utilizes non-blocking(asynchronous) code
Node.js important info
Node.js is asynchronous by nature