Mark As Completed Discussion

One Pager Cheat Sheet

  • JavaScript's type coercion changes argument values to ensure that the correct types are used in expressions, both implicitly and explicitly.
  • In JavaScript, explicit coercion occurs when a value or expression is explicitly converted to a different data type.
  • The typeof operator is used to determine the data type of a given value and return a string that identifies its type.
  • JavaScript provides a typeof operator that can examine a value and tell you its type.
  • Using === allows you to compare two values and determine if they are equal and of the same type.
  • JavaScript has both strict and type-converting comparisons to check for value equality, with strict comparison disallowing coercion and abstract comparison allowing it.
  • The scope in JavaScript determines the visibility and lifetime of variables and functions, and defines how and where these variables can be accessed based on their context of declaration.
  • Variables in JavaScript are associated with a particular scope, which determine their availability to code found lexically within a block and the ability to make their names unique among the same scope.
  • A callback is a flexible and modular programming pattern which increases code abstraction and maintains code maintainability.
  • A callback function is passed to another function as an argument and executed after some operation has been completed.
  • Strict Mode is a feature of ECMAScript 5 (ES5) that helps to prevent certain actions and make code more likely to throw exceptions when errors arise by using the "use strict" statement.
  • The use strict literal helps to prevent errors by throwing an error if a global variable is created unintentionally.
  • No, a polyfill (also known as a shim) is not a UI library in JavaScript; it is code that replicates the expected functionality of modern browsers so that older browsers can also run a particular application or webpage.
  • Polyfills are pieces of code or plugins that enable modern functionality in browsers that have not implemented it natively, and it is not exclusive to Javascript.
  • No value is intentionally absent when null is used, while undefined means the variable is unassigned and has not been declared.
  • JavaScript and TypeScript have two bottom types, null and undefined, which are intended to indicate different states of something either uninitialized or currently unavailable.
  • The code will output 5 because b was declared without the var keyword, making it globally available, whereas a was declared with the var keyword and was only available within the function.
  • The code uses a variablebdeclared in **global scope** which allows it to output5even though it appears to be declared within a function.
  • The property foo of the object x has been deleted, therefore x.foo will return undefined.
  • The delete operator is used to delete the foo property of object x, resulting in undefined when attempting to reference it.
  • The delete operator is used to delete a global variable of type number (in this case, x) from an object.
  • In JavaScript, any value that's not null, undefined, "", 0, -0, NaN or false is considered "truthy".
  • JavaScript's hoisting behavior allows variables and functions to be accessed before they are declared, though the actual values and logic within them remain in their original place.
  • Javascript moves all declarations to the top of the current scope, allowing a variable to be used before it has been declared, but only with variable hoisting (less common) and function hoisting (more common).
  • The program outputs 0 because of the process of function hoisting and the inability of the delete operator to delete primitive values.
  • The delete operator has no effect on local variables, so the output of this code will be 0.