Javascript basics

Test your JS: http://jsbin.com


Setting up variables:
Declaring - set the name.
Assigning - set the value.

Statements - Executable line of code. Eg. var www = $('.selector').attr(“src”, “https://example.com”);
Expression - Produces a value or is a value. Parts of larger statements. Eg. The function in this statement. $('.selector').on( 'click', function () {});
Keywords - A set of words with reserved functionality in JS. Eg. var, function, etc.
Index - The position or order of a value in an Array.


DOM traversal - moving from a node to its parent, children, or siblings nodes.

Traversing Upwards (parent):

Traversing to children:
1.) Any Node type: ( .childNodes, .firstChild, .lastChild )
2.) Element Nodes: ( .children, .firstElementChild, .lastElementChild, .childElementCount )


Traversing to Siblings:
1.) Any Node type: (.nextSibling, .previousSibling )
2.) Element Nodes: (.nextElementSibling, .previousElementSibling )

  • web_development/js/js-basics.txt
  • Last modified: 2020/09/18 01:50
  • by jimboobrien