Tumgik
Text
java script from a beginners point of view-part 1
I started learning java script this month but it was difficult for me to learn ,may be its easy for some of you but i struggled a lot hence i decided why not to explain java script from my point of view.
Tumblr media
more then a tutorial this is simply my way of telling myself how i learned/a account of my first hand experience.
the prerequisite for this is definitely html and css (basic knowledge).
1.What is java script?
✨java script is a high level language.
✨ languages are of 2 type
  high level(machine independent) and 
 low level(machine dependent)
✨ interpreted programming language
✨ object oriented capabilities
✨ HTML : gives content
✨ CSS : gives design
✨ JAVA SCRIPT  :  gives functionality/interactivity
✨ it is a client side scripting language
✨ java script is case sensitive
✨ there are two ways to use java script >>internal and external
2.Lets start.....
Tumblr media
for writing java script you have to write them inside script tag 
 <script type="text/javascript">      
  </script>
this is a way to create a internal way
3. My first command
Tumblr media
just type the highlighted command on the above image and booom😍😍
your first java command just ran 
Window alert() Method
The alert() method displays an alert box with a specified message and an OK button.
Syntax
alert(message);
this message is a String
4. what is window ??? what is write????  what is this????😲
Tumblr media
here my message “my blog and you can enjoy” got printed on my web page page.
via document.write();
so basically document is a object
document object represents your web page.
If you want to access any element in an HTML page, you always start with accessing the document object.
how document object is used??
HTML DOM document object is the owner of all other objects in your web page.
in short its don of your web-page😎
some examples of how you can use the document object to access and manipulate HTML.
(dont worry for now you can ignore all the things written after documen object)
Finding HTML Elements
document.getElementById(id) ;
document.getElementsByTagName(name) ;
document.getElementsByClassName(name) ;
Adding and Deleting Elements
document.createElement(element)
document.removeChild(element)
document.write(text)  <this was the example >
there are more uses to it which you can search<<thats a link
4.1 .JavaScript can "display" data in different ways:
these are the ways and for now i am going to use and explain document .write()
Writing into the HTML output using document.write().
Writing into an alert box, using window.alert().
Writing into the browser console, using console.log().
Writing into an HTML element, using innerHTML .
Using document.write() after an HTML document is loaded, will delete all existing HTML
1 note · View note