Advanced JavaScript Flashcards
What are Objects in Object-Oriented programming?
Objects are a way to categorize behavior and data
What are objects in JavaScript?
They’re collections of named properties and methods, and they can be created on the fly using the object literal syntax
What is a grouping of data and behavior into an object entity?
Encapsulation
An object inherits properties and methods from another object.
Inheritance
In JavaScript, what is prototypal inheritance?
This means that, when an object inherits from another, the parent object is known as the child’s prototype.
What two references does an object maintain with prototypal inheritance?
Every object maintains a reference to its prototype and every object inherits from the global object object.
What will JavaScript return if an object property doesn’t exist?
undefined
How does multiple inheritance work in JavaScript?
Multiple objects can inherit from one single object, but one single object cannot inherit from multiple other objects although it can inherit from an object that inherits from another.
What is the constructor pattern?
A function called a constructor is used to create new objects. Constructors are used in combination with the new keyword to create objects.
What is this code doing?
var Person = function (name) { this.name = name; };
var tom = new Person(‘tom’);
Implementing the constructor pattern to create new Person’s objects.
What function makes it possible to create, modify and insert elements from JavaScript?
createElement
Example: var div = document.createElement(‘div’);
What is the appendChild method used for?
All elements have the appendChild method that allows you to append an element to it.
Each DOM element has a property that’s actually the DOM element’s parent. To remove an element, you call the ________ method of the parent, passing the child element you want to remove.
removeChild
Example: div.parentNode.removeChild(div);
________ is a new DOM API for drawing on a 2- or 3-dimensional plane.
Canvas
What is the 3D canvas web technology?
WebGL
How does canvas animation work?
By repeatedly clearing the canvas (or a section of it) and redrawing the scene.