uni

Thing1's amazing uni repo
Log | Files | Refs | Submodules

09.02.26.md (1270B)


      1 # 09/02/26
      2 
      3 ## `'[object Object][object Object]'`
      4 
      5 - Technically called ECMA-262, ISO-16262
      6 
      7 - You can use the `script` tag in HTML to write javascript
      8 or you can use the src attr in the tag to use an external file
      9 
     10 - Javascript used C like comments
     11 
     12 - Scripts can also be used as attrs to things like buttons,
     13 for example the attr `onclick` on a button can take a string 
     14 of javascript to be executed on click
     15 
     16 - Functions in javascript look like so
     17 ```
     18 function NAME(ARGS...) {
     19     ...
     20 }
     21 ```
     22 and it is recommend to put funcs in the `head` part of the 
     23 document, but if they will only be used in some sections
     24 then it should be placed next to the section to avoid lag
     25 
     26 - Javascript can interact with html via the DOM, which is basically
     27 an AST of the document. The main way to get the DOM is using
     28 `document.getElementById(ID)` which gives you that node in the 
     29 tree. This function returns an object with the attribute 
     30 `innerHTML` which you can set to a string and it will make an effect 
     31 on the tree
     32 
     33 - Javascript string litterals should be double quotes, while in 
     34 HTML you should use single quotes
     35 
     36 - You can also get info from the browser using the BOM (browser object moddel),
     37 to get the width and height, you can use `window.innerWidth` and `window.innerHeight`