Title | Cab230 - Lecture notes for sem 1 2021. |
---|---|
Course | Web Computing |
Institution | Queensland University of Technology |
Pages | 5 |
File Size | 397.3 KB |
File Type | |
Total Downloads | 26 |
Total Views | 162 |
Lecture notes for sem 1 2021....
WEEK 2 Thursday, 11 March 2021
2:52 pm
LECTURE 2 The application layer • Packet routing = assign a range of IP addresses to each organisation • Domain name = name for IP address HTTP POST & GET requests • Get = receiving a resource, often a static webpage • Post = posting or sending some information, usual example is in a HTML form Access Methods • document.getElementById("main") = Returns unique HTML element with Id = "main" or null if not found. Notes: .innerHTML = good hack, associated with text that is in the element.
•
{…Lucy} = means the identifiers properties will be expanded.
PRACTICAL 2 • Pop = removes last thing in array • Push = adds something to array • Concat = adds a whole list • .join = converts elements of an array into a string • Always use anonymous or arrow functions • Console. Log (Object.keys(tutor)) = will show all the keys in the object
• •
JSON.stringify = The JSON.stringify() method converts a JavaScript object or value to a JSON string. Using JSON.parse we can turn it back into memory to access it like a normal object/property.
Different ways to write functions in JavaScript • Named functions =
Arrow function is more concise as it doesn’t require a return statement.
• • • •
HTML = Hyper text markup language. It’s the information that the page displays and the structure that defines how parts relate to eachother. CSS = Cascading style sheets. Makes HTML look pretty. JS = Javascript. Code that makes things happen Use tailwind.css library, can try play tailwind, can import tailwind.
Arrays • Array in JS can mix up any expressions - strings, numbers, arrays, objects and even functions. Arrows functions
•
Everything after arrows Is what is being returned.
MAP • Can be used to apply a function to every element in a specified array.
FILTER • Creates a new array with all the elements that pass a certain test.
REDUCE • The reduce() method executes a reducer function (that you provide) on each element of the array, resulting in a single output value....