JavaScript was initially creates to make web pages alive. JS can be written right in a web pages HTML to make it interactive. The browser has an embedded engine called the JavaScript engine or the JavaScript runtime.
JavaScript ability in the browser is very limited to protect the user safety. For example a webpages on http://google.com Cannot access htttp://diagram.net and steal information from there.
Developer tools
Every browser has some developer tools which makes a developer life a lot easier.
F12 on chrome opens Dev tools.
We can also write JavaScript Commands in the Console.
The Script tag
- The script tag is use to insert JavaScript into an HTML page.
- The Script tag can be use to insert External or internal Scripts.
Console object methods
The console object has several method, log being one of them. some of them are as follows:
Method | Describe |
assert() | use to assert a condition. |
clear() | clears the console. |
log() | Output a message to the Console. |
table() | Display a tabular data. |
warm () | using for warning. |
error() | using for errors. |
info() | using for special information. |
Interaction
- alert
- it is use to invoke a mini window with a msg
- prompt
- it is use to take user input as string
- confirm
- It is a shows a message and waits for the user to press OR or Cancel. Return true for OR and false for cancel.
Window Object
window object represent browser window and provides method to control it. It is a global object is knows as window Object.
DOM
It is stand for Document object Model. Dom represent the page content as HTML is knows as DOM.
To Identify and Access the DOM Elements
- First, Accessing elements By ID
- Second, Accessing elements By TagName
- Third, Accessing elements By className.
BOM
It is stand for Browser Object modal. The BOM represents additional objects provided by the browser (host environment) for working with everything except the document.
The function alert & confirm & prompt are also a part of the BOM.
If you have any queries regarding this article or if I have missed something on this topic, please feel free to add in the comment down below for the audience. See you guys in another article.
To know more about JavaScripts please check Wikipedia Click here.
Stay Connected Stay Safe. Thank you.
0 Comments