Computer science
What is an algorithm and why should you care?
What is data, data structure? !
Is Js Prototype-based or class-based programming language
[first-class functions] https://en.wikipedia.org/wiki/First-class_function
What is an algorithm and why should you care?
An algorithm is a step by step method of solving a problem. It is commonly used for data processing, calculation and other related computer and mathematical operations. An algorithm is a set of instructions designed to perform a specific task. This can be a simple process, such as multiplying two numbers, or a complex operation, such as playing a compressed video file. In computer programming, algorithms are often created as functions.
What is recursion?
Recursion is an important programming technique, in which a function calls itself.
What is data, data structure?
Data structure is a particular way of organizing and storing data in a computer so that it can be accessed and modified efficiently. More precisely, a data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data.
What is OOP, object, class?
OOP (Object-Oriented Programming) is an approach in programming in which data is encapsulated within objects and the object itself is operated on, rather than its component parts.
Objected-oriented programming refers to a programming methodology based on objects, instead of functions and procedures. These objects are organized into classes, which allow individual objects to be group together.
Object refers to a data structure containing data and instructions for working with the data. Objects sometimes refer to real-world things, for example a car or map object in a racing game. JavaScript, Java, C++, Python, and Ruby are examples of object-oriented programming languages.
In object-oriented programming, a class defines an object’s characteristics. Class is a template definition of an object’s properties and methods, the “blueprint” from which other more specific instances of the object are drawn.
Prototype-based programming
JavaScript is heavily object-oriented. It follows a prototype-based model (as opposed to class-based).
JavaScript is an object-based language based on prototypes, rather than being class-based. Because of this different basis, it can be less apparent how JavaScript allows you to create hierarchies of objects and to have inheritance of properties and their values. This chapter attempts to clarify the situation.
Prototype-based programming is a style of object-oriented programming in which classes are not explicitly defined, but rather derived by adding properties and methods to an instance of another class or, less frequently, add them to an empty object.
In simple words, this type of style allows creating an object, without defining its class.
Class-based object-oriented languages, such as Java and C++, are founded on the concept of two distinct entities: classes and instances.
A class defines all of the properties (considering methods and fields in Java, or members in C++, to be properties) that characterize a certain set of objects. A class is an abstract thing, rather than any particular member of the set of objects it describes. For example, the Employee class could represent the set of all employees. An instance, on the other hand, is the instantiation of a class; that is, one of its members. For example, Victoria could be an instance of the Employee class, representing a particular individual as an employee. An instance has exactly the same properties of its parent class (no more, no less). A prototype-based language, such as JavaScript, does not make this distinction: it simply has objects. A prototype-based language has the notion of a prototypical object, an object used as a template from which to get the initial properties for a new object. Any object can specify its own properties, either when you create it or at run time. In addition, any object can be associated as the prototype for another object, allowing the second object to share the first object’s properties.