Skip to content

Latest commit

 

History

History
55 lines (40 loc) · 5.07 KB

programming_with_jacascript.md

File metadata and controls

55 lines (40 loc) · 5.07 KB

Script / Expression / Operator / Function / Declaration / Call / Parameters / Arguments / Return value / Refactoring

Code 102 Table of Contents

<== Home 🏠 Forward ==>

Programming with JavaScript

🎓 JAVASCRIPT MASTER CHEAT

🎓 Functions

Here are six rules you must always follow when giving a variable name:

  1. The name must begin with a letter, dollar sign ($), or and underscore (_). It must not start with a number.
  2. The name can contain letters, numbers, dollar sign ($), or an underscore (_). Note that you must not use a dash (-) os a period (.) in a variable name.
  3. you cannot use *keywords or reserved words. Keywords are special words that tell the interpreter to do something. Keywords/Reserved Words
  4. All variables are case sensitive, so score and Score would be different variable names, but its bad practice to create the same name using different cases.
  5. Use a name that describes the types of information that the variable stores. For example firstName might be used to store a persons first name, lastName, age etc.
  6. camelCaseYourVariableName or you_can_use_an_underscore however; you cannot use (-) a dash.

Output to the console

console.log("ALOYSIOUS TAKES REDONK READING NOTES!");

Term Context
Array an array is a special type of variable. It doesnt just store one value; it stores a list of values.values and arrays are seperated by commas index numbers for numbering an array start at 0 not 1
Script is a series of instructions that a computer fan follow to achieve a goal.
Expression anexpression evaluates into (results in) a single value. There are two kinds: expressions that assign a value to a variable ( var color = 'beige'; the value of color is now beige) and expressions that use two or more values to return a single value ( var = area 3 * 2; the value of area is now 6 )
Operator expressions rely onoperators; they allow programmers to create a single value from one or more values.
Programmatic problem solving computers follow a series of instructions one after another:programatically
Function Functions consist of a series of statements that have been grouped together because they perform a specific task.
Objects Programmers use objects to create models of the world using data. Objects are mae up ofproperties and methods.
Built-in Objects The browser comes with a set of objects that act liek a toolkit for creating interactive web pages.
Declaration before you can use a variable, you need to announce that you want to use it. This involves creating the variable and giving it a name.Programmers say that you declare a variabe
Tata types Numeric: 0.75 , String: 'Hi Aloysious!', Boolean: true
Call The call() method is a predefined JavaScript method. It can be used to invoke (call) a method with an owner object as an argument (parameter). With call(), an object can use a method belonging to another object.Having declared the function, *you can then execute all of the statements between its curly braces with just one line of code. This is known as calling the function.
Parameters Functionparameters are the names listed in the function definition.
Arguments Functionarguments are the real values passed to (and received by) the function.
Return value The return statement stops the execution of a function and returns a value from that function.Tip: Use the void keyword to specify that a method should not have a return value TIP
Refactoring code refactoring is the process of restructuring existing computer code—changing the factoring—without changing its external behavior. Refactoring is intended to improve the design, structure, and/or implementation of the software (its non-functional attributes), while preserving its functionality. Potential advantages of refactoring may include improved code readability and reduced complexity; these can improve the source code's maintainability and create a simpler, cleaner, or more expressive internal architecture or object model to improve extensibility. Another potential goal for refactoring is improved performance; software engineers face an ongoing challenge to write programs that perform faster or use less memory.
this the keywordthis is commonly used inside functions and objects. Where the function is declared alters what this means. It always refers to one object, usually the object in which the function operates.

Read

  • Duckett: JavaScript & jQuery:
  • Intro + Scripts: Pages 1 - 24
  • Expressions + Operators: 74 - 79
  • Functions: 88 - 94

Code 102 Table of Contents

<== Home 🏠 Forward ==>