LEARNING JAVASCRIPT PART- 1
LEARNING JAVASCRIPT PART- 1
JavaScript is a very
powerful, versatile, and popular programming language. Infact it is the de facto
programming language of the web so you can find it anywhere from your smart phone
to your pc .It was first arrived in the mid-1990s; it is grown to be one of the
world's most popular
programming languages.
If you want to learn the web
development, it is a must have learned language for you. Also it is in top 5
language to learn this year so, I have decided to start a series to cover
basics of JavaScript before we move to the advance topics.
Topics we are going to cover
in this series are;
1.
Using JavaScript in HTML File and Browser Console
2. Variables
in JavaScript
3. Operators
4. Arrays
5.
Objects in JavaScript
6. Functions
7.
Loops and Jumps
8. The Document Object Model
So in this part we are going to set up environment for
learning JavaScript so let’s get started…,
Using JavaScript in HTML File and Browser Console
Opening console in browser window
To activate Developer Tools in
your browser depending on the browser and operating system we can,
Chrome
On Windows
and Linux, press Control+ Shift+
J.
On Mac, press cmd +Opt + J.
Firefox
Windows and Linux, press Control
+Shift+ K.
On Mac Cmd + shift + J.
Internet Explorer
Press F12.
For other browsers ,just Google it :).
In Opened console window type in this line
alert("Hello World!");
This must open up a pop up saying "Hello World!".We learn about
alert(); in function later on.
You can also do mathematical calculations like this;
Using JavaScript in HTML File
Console is for just
quick testing or for learning to do something on very basic level but in actual
use JavaScript is written in a HTML file or is linked to it .To do so HTML provides a <script>tag, inside of which we can write our JavaScript code.
Let’s
have an example of it,
<!doctype html>
<html>
<head>
<title>Example title>
<script>
// our JS code will be
written here as below..
alert("Hello World!");
//alert message pop up
</script>
</head>
<body>
</body>
</html>
This piece of code will produce a pop up window saying Hello world .
Here ‘//’ mean that we are writing a comment which have nothing
to do with our program so the browser will not execute it while running our code.
’// ‘ are used to write single line comments .
’// ‘ are used to write single line comments .
// Single Line Comment
For writing a multi line comment just do this,
/*
Multi
Line
Comment
*/
Next we will be going to learn about variables in
javascript.
Wow! Thanks for that sweet intro, I have a om html and css, but no time to continue to Js. This just makes me want to continue asap.
ReplyDeleteThankyou Tanyi Melvis Bechemnyo I love JS a lot...i am just completing the series offline soon publish other parts
ReplyDeleteoh and you are the first one to comment on deecoder special thanks for that
Thankyou Tanyi Melvis Bechemnyo I love JS a lot...i am just completing the series offline soon publish other parts
ReplyDeleteoh and you are the first one to comment on deecoder special thanks for that
I studied JS at University *snores* I'm more of a creative soul who hasn't looked at it since and that over a decade ago. But my husband would be really interested in this so I'm going to pass your blog address along! Can I just say that I love your simple layout but I struggled to read the heading of your blog post in the script (only because I'm quite tired now and it actually made my eyeballs shade, it's gross and it's a connective tissue thing, but it's just incase other people struggle to read it too). Keep up the really informative posts!
ReplyDeleteClaire - startacraftblog.com
Thank you so so much for your review and passing my blog address along thankyou so much. sorry for heading
DeleteThis kind of stuff is always way over my head, you have an easy to follow description. Thank you for this.
ReplyDeleteThankyou kaylee i am about to finish writing the rest of series(just going to upload it on next week or so) I hope you like it
Delete