Skip to content

Instantly share code, notes, and snippets.

@imralpharvin
Created September 13, 2020 20:15
Show Gist options
  • Select an option

  • Save imralpharvin/326609aa54a418c0903fb6703d28bee2 to your computer and use it in GitHub Desktop.

Select an option

Save imralpharvin/326609aa54a418c0903fb6703d28bee2 to your computer and use it in GitHub Desktop.
Javascript notes

Javascript

  • Program the behaviour of web pages

script

<script>
  • Where to put Js code in head or body

Link HTML and JS

<script src="/js/myScript1.js"></script>

You can link html and js file using script above

HTML - DOM innerHTML

document.getElementById("demo").innerHTML = 5 + 6;

browser console

console.log

Javascript is case sensitive

Syntax

var = x + y;

Comment

Like C

Equal value and equal type

===

Data types

  • String
  • Number
  • Array []
  • Object {}

function syntax

function_name (){}

HTML events

onclick

JSON JavaScript Object Notation

json.parse()

https://www.w3schools.com/js/default.asp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment