JavaScript Tutorial for Beginners - Part 3 | JavaScript Output | Learn Web Technologies

Опубликовано: 02 Апрель 2026
на канале: Learn Web Technologies
41
2

CSS Playlist
   • CSS Tutorial for Beginners  
HTML Playlist
   • Html tutorial for beginners  
Sign up for my newsletter to receive weekly updates
http://bit.ly/2RRFktj
Join our facebook page
bit.ly/2OKQYV7

JavaScript Output

JavaScript Display Possibilities
1) Writing into an HTML element, using innerHTML.
2) Writing into the HTML output using document.write().
3) Writing into an alert box, using window.alert().
4) Writing into the browser console, using console.log().

Using innerHTML
To access an HTML element, JavaScript can use the document.getElementById(id) method.
The id attribute defines the HTML element. The innerHTML property defines the HTML content:

Changing the innerHTML property of an HTML element is a common way to display data in HTML.

Using document.write()
For testing purposes, it is convenient to use document.write():
Note: Using document.write() after an HTML document is loaded, will delete all existing HTML:

The document.write() method should only be used for testing.

Using window.alert()
You can use an alert box to display data:

Using console.log()
For debugging purposes, you can use the console.log() method to display data.

----------------------------------------------------------------------------------------------------------------
#LearnWebTechnologies #Javascript #JavascriptTutorialForBeginners #JavascriptPlaylist