Learn JavaScript Programming

A scripting language that enables you to create dynamically updating content, control multimedia, animate images, and pretty much everything else.

JS Introduction
JS Control flow
JS Functions
JS Objects
JS Types
Exceptions and Modules
JS ES6
JavaScript Asynchronous
Miscellaneous

JS DOM

When an HTML document is loaded into a web browser , it becomes a document object.

The document object is the root node of the HTML document.

The document object is a property of the window object.

The document object is accessed with:

window.document or just using document and then name of method

For example :

Run code

Document Object Properties and Methods

The following properties and methods can be mainly used on HTML documents:

Name Description Link
addEventListener Returns the currently focused element in the document Run code
body Sets or returns the document's body (the element) Run code
createAttribute Creates an attribute and returns the attribute as an Attr object. Run code
cookie Returns cookies with all name/value pairs present in the document. Run code
querySelector It returns the first element that matches a specified CSS selector(s) in the document Run code
querySelectorAll Returns a static NodeList containing all elements that matches a specified CSS selector(s) in the document Run code

Now that you know some of the document methods, let's learn console.log methods


Share this page on :