-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic.html
More file actions
43 lines (39 loc) · 3.16 KB
/
Copy pathbasic.html
File metadata and controls
43 lines (39 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pogramming for Beginners</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="topnav">
<a href="index.html">Home</a>
<a class="active" href="basic.html">JS basics</a>
<a href="LinkedLists.html">JS linked lists & Array Methods</a>
<a href="Functions.html">JS higher order functions</a>
<a href="jsHtml.html">JS html</a>
</div>
<h1>Basic javascript</h1>
<h2><hr>- Bindings, Arrays, Loops, Functions and Definitions</h2>
<p> Basic js is composed of bindings. Bindings are keywords which create values like the keyowrds let, const, var all are made to create objects.
Functions manipulate objects in order to change values. Functions are made use either( let functionName = (Var) =>{};) or the calssic way( function
functionName(Var){}). Methods are built in functions that are made for commonly used functions. Arrays are created using let arr = []; or something
like that you can use let or const var is kinda trash but they are used for storing multiple elements seperatly. also theres for(let i = 0; i <
size; i++){}, while(i < beancount){} and (array1.forEach(element => console.log(element)). (var being passed in => function) </p>
<h2><hr>Secret Life of Objects</h2>
<p>Methods: properties that hold a function (let rabbit = {}/ rabbit.speak = function(var){}). Methods are called like (obj.method()).
/.this/ method -> automatically points at the object that it was called on. </p>
<h3>example 1</h3>
<p><br><img src="images/Screen Shot 2023-01-23 at 11.36.52 AM.png" alt="ex2.png" width="970" heigth="314"> <br> <br>
If you want to pass it explicitly, you can use a function’s call method, which takes the this value as its first argument and treats further arguments as normal parameters. <br> <br>
<img src="images/Screen Shot 2023-01-23 at 11.40.44 AM.png" alt="ex3.jpg" width="574" height="70"> <br> <br> Using this in order to refrence the object being passed into the function this . length refrences the length section of the name value pairs.
<br> <br> <img src="images/Screen Shot 2023-01-23 at 11.48.19 AM.png" alt="ex4.jpg" width="701" height="138"> </p>
<h2><hr>Prototype</h2>
<p>The prototype is a value set to all objects to fallback value. Object.getPrototypeOf(obj) returns the prototype of an object. <br> <br>
<img src="images/Screen Shot 2023-01-23 at 12.05.22 PM.png" alt="ex5.png" width="701" height="138" > <br> <br> If its a method or a function you might have the default value of Function.prototype or Array.prototype... the general term is Object.prototype. Object.create to create a specific prototype. <br> <br>
<img src="images/Screen Shot 2023-01-23 at 12.18.34 PM.png" alt="ex6.png" width="787" height="238"> <br> A use for this would be making mad libs. </p>
<h2></h2>
</body>
</html>