You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
B322/Important Notes.txt

99 lines
7.1 KiB
Plaintext

S21 Notes:
Functions: Functions are blocks of reusable code that perform a specific task. They take input, process it, and return an output.
Function Declaration: A function declaration is a way to define a function in JavaScript using the `function` keyword followed by the function's name and parameters.
Function Invocation: Function invocation means calling or executing a function to perform its defined task.
Differences between function declaration vs function expression: Function declaration is hoisted (i.e., can be called before it's defined) and has a named identifier, while function expression is not hoisted and can be anonymous or have a name.
Function scoping: Function scoping refers to the concept that variables defined within a function are only accessible within that function and are not visible in the outer scope.
Function scope: Function scope is the area within a function where a variable can be accessed. Variables defined inside a function have function scope and are not visible outside of it.
Return statement: The return statement is used in a function to specify the value that should be outputted by the function when it is called.
Importance of return statement: The return statement is crucial because it allows a function to produce an output that can be used in other parts of a program. It's how a function communicates its result to the code that called it.
S22 Notes:
Parameters: Parameters are variables listed in the function definition. They act as placeholders for values that the function will receive when it is called.
Arguments: Arguments are the actual values that are passed to a function when it is called. They correspond to the parameters defined in the function declaration.
Functions as Arguments: This refers to the concept of passing a function as a value to another function. This allows for dynamic behavior and is a powerful feature in JavaScript.
Invoking functions: Invoking a function means calling or executing the function to perform its defined task. This is done by using the function's name followed by parentheses, and providing any required arguments.
S23 Notes:
console.warn: In JavaScript, console.warn is a method that allows you to log warning messages to the console. It's often used to indicate potential issues or non-critical problems in your code.
if statement: The if statement is a control flow structure that allows you to execute a block of code if a specified condition evaluates to true. If the condition is false, the code block is skipped.
if-else statement: The if-else statement is an extension of the if statement. It provides an alternative code block to execute if the initial condition evaluates to false.
else-if clause: The else-if clause allows you to specify additional conditions to be checked if the previous if or else-if conditions are false. It's used in conjunction with the if-else statement.
else statement: The else statement is used in conjunction with an if statement to specify a block of code to execute if the condition evaluates to false.
Truthy value: A truthy value is a value that is considered true when encountered in a Boolean context. This includes non-empty strings, non-zero numbers, and objects.
Falsy value: A falsy value is a value that is considered false when encountered in a Boolean context. This includes false, 0, null, undefined, NaN, and an empty string ('').
Conditional Ternary Operator: The conditional (ternary) operator is a concise way to write an if-else statement in a single line of code. It takes the form condition ? expressionIfTrue : expressionIfFalse.
Switch statement: The switch statement is used to select one of many code blocks to be executed. It evaluates an expression and executes the corresponding case.
Try-Catch-Finally statement: The try-catch-finally statement is used for exception handling in JavaScript. The try block contains the code that might throw an exception, the catch block handles the exception, and the finally block is executed regardless of whether an exception was thrown or caught.
S24 Notes:
While loop: A while loop is a control flow statement that allows a block of code to be executed repeatedly as long as a specified condition is true.
Expressions/Conditions: In JavaScript, expressions are pieces of code that produce a value. Conditions are expressions that can be evaluated as true or false.
Statement: A statement is a single line of code or a group of lines that perform a specific action. In JavaScript, statements can be things like variable declarations, loops, or function calls.
Increment: Incrementing means increasing the value of a variable by a certain amount, typically by 1.
Decrement: Decrementing means decreasing the value of a variable by a certain amount, typically by 1.
Do while loop: Similar to a while loop, a do-while loop executes a block of code repeatedly, but it checks the condition at the end of the loop, so the code inside the loop is executed at least once.
Prompt: prompt is a method in JavaScript that displays a dialog box to the user, prompting them to input some data. It's commonly used in web development for getting user input.
typeof: typeof is an operator in JavaScript that allows you to determine the data type of a value or expression.
For loop: A for loop is a control flow statement that allows code to be executed repeatedly for a specific number of times. It consists of an initialization, a condition, and an iteration.
Initialization: Initialization is the step in a loop where you set the initial value of a variable that controls the loop.
Final Expression: The final expression is the condition that is evaluated at the end of each iteration of a loop. If this condition is true, the loop continues; if false, the loop ends.
.toLowerCase: .toLowerCase is a method in JavaScript that converts a string to lowercase letters. For example, it would convert "HELLO" to "hello".
S25 Notes:
Objects: In JavaScript, an object is a collection of key-value pairs, where each key is a string (or Symbol) and each value can be any data type.
Key-pairs: In an object, a key-value pair consists of a key (a unique identifier) and its corresponding value.
Constructor function: A constructor function in JavaScript is a blueprint for creating objects. It's used to define a type of object and how it should be initialized.
"this" keyword: The this keyword in JavaScript refers to the object that is currently executing the function. It allows a function to access and work with its own object.
"new" operator: The new operator is used to create an instance of a user-defined object type or one of the built-in object types in JavaScript.
Dot notation: Dot notation is a way to access properties and methods of an object by using a dot (.) followed by the property or method name.
Square bracket notation: Square bracket notation is an alternative way to access properties and methods of an object by using square brackets [] and passing in a string containing the property or method name.
Object methods: Object methods are functions that are stored as properties within an object. They can be called and executed just like any other function, but they are associated with a specific object and can access its properties.