NodeJS has a number of global objects that we can use without import.
- global, globalThis
- process
- console
- Buffer
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>Async</title> | |
| <style> | |
| html { | |
| font-family: | |
| system-ui, |
| const names = ['Archer', 'Pam', 'Lana', 'Krieger', 'Cyril']; | |
| handleNames(names); | |
| names2(names); | |
| function handleNames(arr) { | |
| //destructure an array | |
| // let first = arr[0]; | |
| // let second = arr[1]; | |
| const [first, second, ...camillo] = arr; | |
| console.log(first, second); |
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>CSS Grid</title> | |
| <link rel="stylesheet" href="css/main.css" /> | |
| </head> | |
| <body> | |
| <div class="container"> |
| <!doctype html> | |
| <html> | |
| <head></head> | |
| <body></body> | |
| </html> |
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>Exercise Two</title> | |
| <!-- Google Font preconnects and links go here --> | |
| <link rel="stylesheet" href="css/main.css" /> | |
| <script type="module" src="js/main.js"></script> | |
| </head> |
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>Get My Attention :: Tech Company</title> | |
| <link rel="preconnect" href="https://fonts.googleapis.com" /> | |
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> | |
| <link | |
| href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&family=Noto+Sans:ital,wght@0,100..900;1,100..900&family=Noto+Serif:ital,wght@0,100..900;1,100..900&display=swap" |
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>We Don't Care | About Us</title> | |
| <link rel="preconnect" href="https://fonts.googleapis.com" /> | |
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> | |
| <link | |
| href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&family=Noto+Sans:ital,wght@0,100..900;1,100..900&family=Noto+Serif:ital,wght@0,100..900;1,100..900&display=swap" |
| // import abc from './abc.js'; //local file import | |
| // import express from 'express'; //node_modules | |
| import http from 'node:http'; //import from NodeJS | |
| const server = http.createServer(handleRequests); | |
| const cheeses = ['Cheddar', 'Mozzarella', 'Danish Blue']; | |
| function handleRequests(request, response) { | |
| //every call from a client comes through here |
| console.log('this is main.js'); | |
| console.log('edited'); |