JavaScript Flashcards
Types of directives
Manipulate DOM.
Components - directives with template.
Structural - ngFor, nfIg
Attribute - change appearance behaviour
Services in Angular
Reusable pieces of code, organises logic that can be used anywhere in the code.
Data binding in Angular
Communication between component and template. Component to template - attribute, interpolation, style, class []. Template to component - event. Two way [()].
What are extra features of TS, JS doesn’t have.
Has ES6 plus more. Interfaces, enums, generics, access modifiers, modules, optional params. It’s own CLI, error checking, types, compiler.
Why is JS great?
Richer interfaces, quicker feedback loop - doesn’t have to go to server, user gets what they want. Runs in browser.
What is call back?
Function that is invoked once a specified action finishes.
What is closure?
JS concept in which inner function has access to variables of parent function + global.
What is ECMA?
Set of standards, guidelines for JS. New ES6.
What is hoisting?
Feature of JS when JS engine starts to interpret the code, it moves all the definitions to the top of the script.
Why arrow fn?
Scope safe, don’t have this, don’t have constructor, are not hoisted, no name.
What is scope?
Defines availability, accessibility of variables in parts of code.
What are prototypes?
Type of inheritance but it’s a working sample, not predefined. Standard that has to be followed objects prototype can be composed of various properties.
spread vs rest
Spread - makes copies, can represent array values.
Rest - params.
Observable vs Promise
Way to handle async processes. Observable - returns multiple values overtime, lazy loaded - nothing until we can subscribe, provides error handling. Promises - return only one value, as soon as created it starts to execute.