Flashcards
Javascript general
Flashcards do conjunto (25)
- 1Is prototype enumerable - can you iterate this property on an object?No
- 2What is prototype?It is a 'pseudo' property that allows you to access __proto__.
Every object inherits properties from some other object, and it is this other object that is the object’s prototype attribute or “parent.” - 3What is a constructorA constructor is a function used for initializing new Objects.
Also all objects that inherit from another object also inherit a constructor property. - 4Does javascript pass by value or by reference?Arguments in a function are passed by value. However if you pass an object and modify the properties of that object outside of the function then those properties will have changed.
- 5What is Polymer?Polymer is a polyfill for the (incoming) spec for HTML5 web components
- 6What are the ES5 datatypes?Number, String, Boolean, Null, undefined, Object
- 7What does 'use strict' do?Enforces strict syntax: does not allow undeclared variables, etc.
- 8What is typeof null?Object
- 9What is typeof NaN?Number
- 10What is typeof Array?Object
- 11How do you test if something is an array?IE9+: isArray(). Otherwise you can test myArray.constructor === Array
- 12What are the four types of function invocation in Javascript?1. Method invocation: function is part of an object
2. Function invocation: add(2,3). this is bound to the global object
3. Constructor invocation: this is bound to the new object which is created
4. call, apply: this is set explicitly - 13What is a closure?A function that retains the value of its local variables even after the function has returned.
- 14What are the datatypes in Javascript?String, Number, Boolean, Object, Array
- 15What is the quickest way of finding an element in an array?array.indexOf() - enforces strict equality, may not work in all browsers
- 16How do you compare objects in Javascript?You could stringify the objects and compare the results. Underscore has a method: isEqual
- 17What is a polyfill?Code or plugin that enables functions or libraries to be used cross browser or when those functions are not supported
- 18Name some Javascript developers that you followAddy Osmani, Paul Irish, Todd Motto, Stoyan Stefanov
- 19What are some in-built methods of Array()?pop(), push(), indexof(), toString(), join(), slice(), splice()
- 20What are some in-built methods of Object()?toString(), hasOwnMethod(), hasOwnProperty(), isPrototypeOf()
- 21What does Object.create() do?Creates a new Object with the supplied prototype and properties
- 22What are some features of ES6?- Maps, sets
- Templates
- Modules, classes - 23What happens when you invoke new?1. A new object is created.
2. prototype of original object is assigned to new one.
3. Constructor is called on new Object with new 'this' as context. - 24How do you determine if an object is a prototype of another object?newObject.isPrototypeOf(OldObject)
- 25What are some bad things about Javascript?Global variables
- Implied globals
- No inbuilt modularity
Scope
- Block syntax but not block scope
New
- Miss it and cause problems
Informações
- Descrição
- A-Level Javascript FlashCards sobre Javascript general, criado por James Drummond em 16-12-2014.
- Criado por
- James Drummond
- Visualizações
- 5
- Tags
- Avaliação