JavaScript Flashcards
What is JavaScript?
A text-based programming language used both on the client and server sides that allows you to makes webpages dynamic. It calculates, manipulates, and validates data. It can update and change html and css.
What is ECMAScript?
European Computer Manufacturers Association Script. A JavaScript standard standard intended to ensure the interoperability of web pages across different browsers
What are the data types in JavaScript?
JS data types have 2 categories: primitive and non primitive. The 7 primitive are: number, Boolean, string, null, undefined, and symbol. The 1 non-primitive is object.
Null vs Undefined
Undefined is a variable that refers to something that doesn’t exist and the variable isn’t defined by anything. Null is defined but is missing a value.
What is type coercion?
The explicit or implicit conversion of values from one data type to another. Implicit is when JS coerces the value type to the expected under the hood. Explicit is done manually. For example string value to an equivalent number value. There are 3 types of conversion: number, string, and Boolean.
What are closures?
A closure is a function having access to the parent scope, even after the parent function has closed.
A combination of a function bundled together with references to its surrounding states. Important because it gives access to an outer functions scope from an inner function.
What is prototypal inheritance?
The ability to access object properties from another object. It is used to add new properties and methods to an existing object constructor.
What are template literals and arrow notation?
Literals delimited with backtick (‘) characters allowing for multiline strings string interpolation with embedded expressions, and special constructs called tagged templates.
String interpolation: to create strings by doing substitution of placeholders
=> Arrow function provides and alternate way to write a short syntax for functions
What is hoisting?
The process of moving all declarations of functions, variables, or classes to the top of their scope before executing the code. This ensures all functions are safely declared before being used in the code regardless of whether their scope is global or local.