javascript - rra-dev/studious-garbanzo GitHub Wiki


tags:

  • web
  • freeCodeCamp

JavaScript Notes

Table of Contents

Experiments / Stretch Goals

  1. Rewrite record-collection.js to use switch/case
    1. Testing Environment?

Timeline / Dailies

[!note]- 20221219 Start Declare Javascript Variables Break Java Variable Data Types

  • undefined
  • null
  • boolean
  • string
  • symbol
  • bigint
  • number
  • object

[!note]- 20221220 Start Compound Assignment With Augmented Addition Escape Sequences

Code     Output
 \'      single quote
 \"      double quote
 \\      backslash
 \n      newline
 \t      tab
 \r      carriage return
 \b      word boundary
 \f      form feed

Break Use Conditional Logic with If Statements Stop # Comparisons with the Logical Or Operator

[!note]- 20221229 freeCodeCamp/javascript/ for projects and other bits Comparisons with the Logical Or Operator Start

[!bug] FreeCodeCamp Bug indentation and cariage returns can change the correctness of the solution

Break Time Accessing Object Properties with Dot Notation

[!note]- 20221230 Start Accessing Object Properties with Dot Notation Migrated notes to separate file Javascript Notes (This File) End for now Nesting For Loops

[!note]- 20221231 Start Nesting For Loops Break after I leaned and lost my work Profile Lookup Really struggling with this problem going to spend sometime with a different approach Eloquent JavaScript - El_js Start Values, Types, and Operators Program Structure

[!note]- 20230101 Start

[!bug]- Checking Code Unable/unwilling to run code in my environment so using https://eloquentjavascript.net/code

- Looping a Triangle
- FizzBuzz
- chessboard

Functions Exercises

- Minimum
- Recursion
- Bean counting

End? Data Structures: Objects and Arrays

[!note]+ Start

20230903

  • Starting the JavaScript Algorithms and Data Structures class after a couple of months

Operators

Operator Description Example
= Assignment let x = 5;
+ Addition let x = 5; let y = 2; let z = x + y;
* Multiplication let x = 5; let y = 2; let z = x * y;
** Exponentiation
/ Division
% Modulus (Division Remainder)
++ Increment
-- Decrement
Assignment Operator Example Same As
= x = y x = y
+= x += y x = x + y
-= x -= y x = x - y
*= x *= y x = x * y
/= x /= y x = x / y
%= x %= y x = x % y
**= x **= y x = x ** y
Comparison Operators Description
== equal to
=== equal value and equal type
!= not equal
!== not equal value or not equal type
> greater than
< less than
>= greater than or equal to
<= less than or equal to
? ternary operator

Ternary Operators

Conditional (ternary) operator (mozilla.org)

function getFee(isMember) {
  return (isMember ? '$2.00' : '$10.00');
}

console.log(getFee(true));
// expected output: "$2.00"

console.log(getFee(false));
// expected output: "$10.00"

console.log(getFee(null));
// expected output: "$10.00"
Ternary Syntax
condition ? exprIfTrue : exprIfFalse
expIfFalse is Falsy not strict False

The following table provides a complete list of JavaScript falsy values: Src: mdm web docs Glossary: Falsy

Value Description
false The keyword false.
0 The Number zero (so, also 0.0, etc., and 0x0).
-0 The Number negative zero (so, also -0.0, etc., and -0x0).
0n The BigInt zero (so, also 0x0n). Note that there is no BigInt negative zero — the negation of 0n is 0n.
""''`` Empty string value.
null null — the absence of any value.
undefined undefined — the primitive value.
NaN NaN — not a number.
document.all Objects are falsy if and only if they have the IsHTMLDDA internal slot. That slot only exists in document.all and cannot be set using JavaScript.

Escape Sequences

Reference: Escape Sequences

Code     Output
\'      single quote
\"      double quote
\\      backslash
\n      newline
\t      tab
\r      carriage return
\b      word boundary
\f      form feed
⚠️ **GitHub.com Fallback** ⚠️