Ved Prakash JavaScript Quick and Dirty Tutorial-Part - 2 ,(Writing JavaScript Code and Indroduction to JS console in Chrome & Firefox) | codinggiri GuidePedia

4

Hey there Guys ! Welcome to the second post of this series "Quick and Dirty Introduction to JavaScript". In this post we will learn how to write JavaScript Programs. Well There are two ways to write JavaScript Programs (if you are a beginner in JavaScript ) and the two methods are
  1. Putting your JS in HTML
  2. Writing JS in Browser's Console
Lets take the first method first. Now we will put our JS code in HTML document to execute.first we need a HTML(core markup). Here it is
<!doctype html>
<html>
 <head>
  <title>JS in HTML</title>
   
  <script type = "text/javascript">
   alert("Hello ! Javasript ");
  </script> 
 </head>
 <body>
 
 </body>
</html>
save that code with a .html extension and run it in your browser it will execute and show a message box in your browser like this


The second Method is Writing JavaScript into Browser's Console. I am using Coogle Chrome but you are free to use any other as wel.
To open JavaScript Console in Chrome follow this


After this you will see a JS Console like this


now you can directly Execute JS from Your Browser follow the ScreenShot Below



So now you know how to write JavaScript by both methods. In Next Post


I know there are some firefox fans so i am gonna write a little on Js Console in Firefox and Installing Firebug

follow the screenshot below

Lets take the firefox's built in Js Console first press ctrl + shift + j and you will see something like this (screenshot below)

Now lets take the second option which is Scratch Pad , Press Shift + f4 and the Scratch Pad window will appear(Screenshot below)


You can also run your JS from There
We will Take a Step forward to learn more about JavaScript If you have any problem in finding JavaScript Console in Any Other Browser Please Comment. See you in Next Post Thanks For Reading

Post a Comment

  1. Hi Prakash,
    You've designed your blog well..! Keep it up..! I don't have much knowledge in HTML and CSS..! I hope you could help me..!
    This is my blog: http://www.josephstutorialshop.blogspot.com
    I've implemented Prettify Syntax Highlighting in my blog. The problem is while using it some of the code lines are outside the border! Can you please tell me how can I fix that?

    ReplyDelete
    Replies
    1. Hey Joseph Glad you like the design of my blog :) Let me tell you that on codinggiri i also use the prettify Sybtax highlighter and it's really awesome. i was on your blog and your tutotials was also good but design .. ?
      Your blog is not responsive and you are using a two coloumn layout that's nasty bro 8-) i'll help you to implement a new theme for your blog soon just keep in touch and the problem you are talking about syntax highlighter it is because of your template i am sure about that.

      Delete
  2. Hi Prakash,
    Thanks for the reply. Anyway I fixed that (Prettify) problem. Instead of adding

    pre class="prettyprint linenums"

    I used:

    pre class="prettyprint linenums" wrap


    That fixed everything. Working nice now.. Thanks for the help..! I'm waiting for your new posts..

    ReplyDelete
    Replies
    1. you can also use code instead of pre :)

      Delete

 
Top