DEV Community

Pratik sharma
Pratik sharma

Posted on • Originally published at blog.coolhead.in

Demystifying JavaScript Terminology

Learn the terms that are highly used in javascript, and that would help you learn javascript better.

  1. Syntax Parser: A Program that reads and determines what it does and if the grammar is valid.

  2. Lexical Environment: where something sits physically in the code you write.

  3. Execution Contexts: A wrapper to help the code that is running.

  4. Variable Environment: where the variables live and how they relate.

  5. Scope: Where variables are available in your code.

  6. Callbacks: A callback isย a function passed as an argument to another function. This technique allows a function to call another function. A callback function can run after another function has finished.

  7. Asynchronous: two or more objects or eventsย notย existing or happening at the same time.

  8. Asynchronous Callback: Asynchronous programming is a technique that enables your program to start a potentially long-running task and still be able to be responsive to other events while that task runs, rather than having to wait until that task has finished.

    ELI5:

    Imagine you're playing with building blocks. You ask your friend to tell you when they're done building a tower. When they're finished, they'll shout "done!" That shout is like the asynchronous callback โ€“ your friend lets you know when they're done with their task, so you can continue playing without waiting for them.

  9. Event Queue: The event queue is responsible for sending new functions to the stack for processing. It follows the queue data structure to maintain the correct sequence in which all operations should be sent for execution.

  10. Types: Types help us understand and manage the different kinds of data we use in our code. Think of them as different categories for things.

  11. Dynamic Typing: Dynamic typing is a concept in programming where the data type of a variable is determined at runtime, while the program is running, rather than at the time of writing the code

  12. Static Typing: Static typing is a concept in programming where the data type of a variable is determined and explicitly declared at the time of writing the code, and it cannot change during runtime.

  13. Primitive Types: A type of data that represents a single value.

  14. 7 data types in Javascript:

    1. Undefined
    2. Null
    3. Boolean
    4. String: sequence of characters
    5. Number: Floating point number
    6. Symbol
    7. BigInt
  15. Operators: Take two parameters and return a single value;

  16. Infix notation: Infix notation is the notation commonly used in arithmetical and logical formulae and statements.

  17. Operator Precedence: which operator functions get called first?

  18. Associativity: what order operator functions get called in left-to-right or right-to-left

  19. Coercion: Converting a value from one type to another

  20. First Class Functions: Everything you can do with other types, you can do with functions.

  21. Function Expression: A Function Expression works just like a function declaration or a function statement, the only difference is that a function name is NOT started in a function expression, that is, anonymous functions are created in function expressions. The function expressions run as soon as they are defined.

  22. Function Statement: A Function Declaration( or a Function Statement) defines a function with the specified parameters without requiring a variable assignment. They exist on their own, i.e, they are standalone constructs and cannot be nested within a non-function block. A function is declared using the function keyword.

  23. IIFE: IIFE (Immediately Invoked Function Expression) is a JavaScript function that runs as soon as it is defined.

  24. Prototype: A JavaScript prototype is a shared set of properties and methods that objects can inherit from, serving as a blueprint for creating and interacting with objects.

ELI5:

Alright, imagine you have a special toy box that has all the rules for making other toy boxes. This special toy box is like the "prototype" in JavaScript.

Every time you want to make a new toy box that works just like the special one, you can use it as a guide. This means the new toy box will have the same features and abilities as the special toy box.

So, the special toy box is the "prototype" that shows other toy boxes how to be, and those other toy boxes are like objects in JavaScript that use the prototype's rules to work properly.

Top comments (3)

Collapse
 
jonrandy profile image
Jon Randy ๐ŸŽ–๏ธ • Edited

You missed BigInt on the data types.

In 15 you say that operators take two parameters (operands). This is true of binary operators, but there are also unary operators that take one operand, and one ternary operator (the conditional operator) that takes three operands.

The description on 21 for function expressions is mostly incorrect. Function expressions CAN have a name, and they do not have to be called immediately... you could store them somewhere, or perform some transformation on them (wrap them etc.) and return that new function.

Both of the following are function expressions:

// a function expression evaluating to an anonymous function
(function() { console.log(123) })

// a function expression evaluating to a named function 
(function myFunc() { console.log(123)})
Enter fullscreen mode Exit fullscreen mode
Collapse
 
biomathcode profile image
Pratik sharma

Got you points. Will edit the blog about the same. @jonrandy Thanks.

Collapse
 
Sloan, the sloth mascot
Comment deleted