Preparing for JS Flashcards

1
Q

What is JavaScript?

A
JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions.
JavaScript is a prototype-based, multi-paradigm, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is Just-in-time compilation?

A

In computing, just-in-time (JIT) compilation (also dynamic translation or run-time compilations)[1] is a way of executing computer code that involves compilation during execution of a program (at run time) rather than before execution.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does it mean that a language has First-class Function?

A

A programming language is said to have First-class functions when functions in that language are treated like any other variable. For example, in such a language, a function can be passed as an argument to other functions, can be returned by another function and can be assigned as a value to a variable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is Prototype-based programming

A

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, adding them to an empty object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is multi-paradigm

A

Some languages are designed to support one paradigm (Smalltalk supports object-oriented programming, Haskell supports functional programming), while other programming languages support multiple paradigms (such as Object Pascal, C++, Java, JavaScript, C#, Scala, Visual Basic, Common Lisp, Scheme, Perl, PHP, Python, Ruby

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is single-threaded programming lang?

A

Single threaded processes contain the execution of instructions in a single sequence. In other words, one command is processes at a time. The opposite of single threaded processes are multithreaded processes. These processes allow the execution of multiple parts of a program at the same time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Why is js a dynamic language?

A

Most languages have some aspect of dynamic behaviour. Even statically typed languages can have a dynamic or variant data type that can contain different data types.

JavaScript is called a dynamic language because it doesn’t just have a few dynamic aspects, pretty much everything is dynamic.

All variables are dynamic (both in type and existance), and even the code is dynamic. You can create new variables at runtime, and the type of variables is determined at runtime. You can create new functions at any time, or replace existing functions. When used in a browser, code is added when more script files are loaded, and you can load more files any time you like.

Nowadays JavaScript is compiled in many implementations, and static code and static types are generated in the background. However, the behaviour is still dynamic, the compiler only generates static types when it finds that the dynamic aspects are not used for a specific object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Why is js lightweight?

A

There Aren’t Too Many Language Structs Available
It’s Not Strongly Typed
Simple Language Build Blocks
Simple Syntax, Easy to Learn
Common and Best Practices Are Easier to Pick Up
High Level Language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does it mean?

There Aren’t Too Many Language Structs Available

A

JavaScript does not have too many language constructs that you can use for building your code. We have functions, different types of loops that can be used on different types of data structures, and built in objects like Math, Date, Array and so. Also statements (like if-else), and declarations (like const, let) are available for creating variables. On first glimpse this does not sound monumental, but these constructs can be used almost too freely, whichever use case we need to cover.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does it mean? JS is Not Strongly Typed

A

JavaScript uses dynamic typing, so everything that you declare or assign, the interpreter tries to figure out, what should be the type of a certain variable. After figuring out what is the type of a variable, it assigns type specific methods to the variable inheriting from its Object Prototype Chain.
Advantages can be that we have incredible freedom in how we want to write our code. Some of this freedom makes really clever workarounds possible, offers solutions to common problems and what preferred solution we choose.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does it mean? Js has Simple Language Build Blocks

A

In JavaScript everything is treated as an object, you can just declare a variable and access a lot of predefined methods right away. Or you can just create a function that processes and handles some data. Much less abstractions than other programming languages like Java or C#.
Devs can choose between an Object Oriented approach, or a functional declarative way to write code in this language.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does it mean? Js has Simple Syntax, Easy to Learn

A

Since JavaScript takes care of a lot of things under the hood, such as dynamic typing, starting programmers can focus on understanding the key concepts, and looking for best practices even in the beginning. With JavaScript, developers can focus on data structures, and best practices more, since the language is simpler in nature.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does it mean? Js Common and Best Practices Are Easier to Pick Up

A

In the last decade JavaScript developed a lot, and developers figured out a lot of best practices that can be used writing an application. Performance and ‘Clean Code’ best practices and design patterns are applied more and more. Even these are heavily included in the design and architecture of modern JavaScript frameworks such as Angular, React, Vue.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does it mean? Js is a High Level Language

A

JavaScript is less hardware close, it means that its core functions are handled in a lower level machine / engine (like memory allocation, pointers, garbage collection, or threading). Also its concurrency model the infamous “Event Loop” is also handled automatically.

For most of the use cases developers regularly meet, they don’t really need to know what happens under the hood, unless they need to do hardcore performance optimization, or using async solutions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does it mean? Js is interpreted

A

JavaScript is an interpreted language, not a compiled language. A program such as C++ or Java needs to be compiled before it is run. … In contrast, JavaScript has no compilation step. Instead, an interpreter in the browser reads over the JavaScript code, interprets each line, and runs it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does it mean? Js is object-oriented

A

To be more precise, JavaScript is a prototype based object oriented language, which means it doesn’t have classes rather it define behaviors using constructor function and then reuse it using the prototype. … JavaScript classes provide a much simpler and clearer syntax to create objects and deal with inheritance.

17
Q

What does it mean? Js has First-class functions

A

In computer science, a programming language is said to have first-class functions if it treats functions as first-class citizens. This means the language supports passing functions as arguments to other functions, returning them as the values from other functions, and assigning them to variables or storing them in data structures.

18
Q

What is Imperative programming?

A

In computer science, imperative programming is a programming paradigm that uses statements that change a program’s state. In much the same way that the imperative mood in natural languages expresses commands, an imperative program consists of commands for the computer to perform. Imperative programming focuses on describing how a program operates.

19
Q

What is Declarative programming?

A

In computer science, declarative programming is a programming paradigm—a style of building the structure and elements of computer programs—that expresses the logic of a computation without describing its control flow.
Common declarative languages include those of database query languages (e.g., SQL, XQuery), regular expressions, logic programming, functional programming, and configuration management systems.

20
Q

What is Procedural programming?

A

Procedural programming is a programming paradigm, derived from imperative programming,[1] based on the concept of the procedure call. Procedures (a type of routine or subroutine) simply contain a series of computational steps to be carried out. Any given procedure might be called at any point during a program’s execution, including by other procedures or itself.

21
Q

List some JavaScript dynamic capabilities

A

JavaScript’s dynamic capabilities include runtime object construction, variable parameter lists, function variables, dynamic script creation (via eval), object introspection (via for … in), and source code recovery (JavaScript programs can decompile function bodies back into their source text).