Js Flashcards
Var declaration
var’s declaration is hoisted not value
== vs ===
== value
=== value and type
Const
No reassignment of value
Window.
Base global object
I frame
Window on window
Access through window.frames
Document.
HTML that is loaded on the window
Undefined
Var has no value. JS sets the value to undefined
Prototype inheritance
Object -> property
Array.prototype.newMethod = ()=>
Function declaration vs expression
Declarations are hoisted
Expressions take variable scope
Promises
Set up an a sync data retrevial
shouldComponentUpdate
Triggered from external changes
Returns true or false
Args - (nextProps, nextState)
Using ref
Ref={input => this.inputElement = input}
componentDidMount() {
if (this.props.position ===0) {
this.inputElement.focus() }
shouldComponetUpdate
shouldComponetUpdate(nextProps, nextState) {
return nextProps.persons !== this.pros.persons
Redux
Global Store -> Reducer -> Action(mapDispatchToProps) -> Dispatch -> Component
Global Store -> Triggers -> Subscription -> Component
Why is typeOf bar === ‘object’ not a good check?
Because null is also an object. Should be
typeOf bar === ‘object’ && bar !== null
If bar should be an array an ES5 check would be:
Array.isArray(bar)