JavaScript – Basics

JavaScript, initially called LiveScript is a robust client-side scripting language, used mainly for make your webpage more interactive. This also helps in communicate data between the server and the browser.

JavaScript is also used in game development and mobile application development. It Also help in reduce the traffic of server side.

JavaScript was developed by Brendan Eich in 1995, which appeared in Netscape, a popular browser of that time.

Please note that JavaScript and Java are very much unrelated. Java is a very complex programming language whereas JavaScript is only a scripting language.

 

Limitation of JavaScript

  1. JavaScript doesn’t support any network related programming.
  2. JavaScript doesn’t support multithreading

 

JavaScript Output

JavaScript can display data in following ways:

 

Dialog boxes() – Display output using alert, prompt and confirm dialog boxes

document.write() – Used to insert text onto your web page (this text can actually be HTML elements).

innerHTML – Used to display output in a specific place or in a division

console.log() – Used to display output on the console of a browser.

 

JavaScript – Variables

A variable is basically an identifier for a value or simply the Variables are used to store values or expressions

The way to use variables is by using the var keyword followed by the variable name.

Example:

var empName;

In this line of code, I declared a variable called empName. Right now, It doesn’t contain any value. So initialization is required here –

Example:

var empName = “Hernan”;

Naming Variables

Following things should be follow when naming them:

– Your variable name should be meaningful or be a noun.

– Your variables can start with a letter, underscore, or the $, they can’t start with a number.

– Spaces are not allowed.

– Variable name should be unique and should not be a keyword.

 

Function in JavaScript

A function is nothing more than a wrapper for some code. A function is a block of code which will be executed only if it is called.

So A Function is a:

– Groups statements together

– Makes your code reusable

Syntax

function functionname()

{

//Set of statements here

}

 

 

Example:

function test()

{

alert(“hello.. Lets learn functions in JS”);

}

The last thing to look at is the function call:

test();

 

77 thoughts on “JavaScript – Basics

  1. Hey There. I found your blog using msn. This is an extremely well written article. I will make sure to bookmark it and come back to read more of your useful information. Thanks for the post. I’ll certainly comeback.|

  2. Oh my goodness! Awesome article dude! Thanks, However I am experiencing problems with your RSS. I don’t understand why I cannot subscribe to it. Is there anybody having similar RSS problems? Anyone who knows the answer will you kindly respond? Thanx!!|

  3. Fantastic beat ! I wish to apprentice while you amend your site, how could i subscribe for a blog web site? The account aided me a acceptable deal. I had been a little bit acquainted of this your broadcast provided bright clear concept|

  4. Hi would you mind letting me know which hosting company you’re using? I’ve loaded your blog in 3 completely different browsers and I must say this blog loads a lot quicker then most. Can you suggest a good web hosting provider at a fair price? Kudos, I appreciate it!|

  5. Have you ever thought about including a little bit more than just your articles? I mean, what you say is valuable and all. Nevertheless just imagine if you added some great images or video clips to give your posts more, “pop”! Your content is excellent but with pics and videos, this blog could definitely be one of the best in its niche. Terrific blog!|

  6. Just wish to say your article is as astounding. The clarity on your post is just spectacular and i can suppose you are knowledgeable in this subject. Well with your permission let me to grab your feed to keep updated with approaching post. Thank you one million and please carry on the enjoyable work.|

  7. Having read this I believed it was rather informative. I appreciate you finding the time and energy to put this information together. I once again find myself spending a lot of time both reading and posting comments. But so what, it was still worthwhile!|

  8. Good day! I could have sworn I’ve been to this web site before but after browsing through many of the posts I realized it’s new to me. Regardless, I’m certainly delighted I found it and I’ll be bookmarking it and checking back regularly!|

  9. An outstanding share! I’ve just forwarded this onto a co-worker who had been conducting a little homework on this. And he actually ordered me breakfast due to the fact that I found it for him… lol. So allow me to reword this…. Thanks for the meal!! But yeah, thanx for spending the time to talk about this subject here on your internet site.|

  10. Greetings I am so delighted I found your webpage, I really found you by accident, while I was searching on Digg for something else, Regardless I am here now and would just like to say cheers for a incredible post and a all round exciting blog (I also love the theme/design), I don’t have time to read it all at the minute but I have saved it and also added in your RSS feeds, so when I have time I will be back to read more, Please do keep up the awesome job.|

  11. Hey there! Would you mind if I share your blog with my facebook group? There’s a lot of folks that I think would really enjoy your content. Please let me know. Thank you|

  12. Woah! I’m really digging the template/theme of this website. It’s simple, yet effective. A lot of times it’s hard to get that “perfect balance” between usability and visual appearance. I must say you’ve done a amazing job with this. Also, the blog loads super fast for me on Opera. Outstanding Blog!|

  13. My partner and I stumbled over here from a different web address and thought I might check things out. I like what I see so i am just following you. Look forward to going over your web page yet again.|

  14. Hi there are using WordPress for your site platform? I’m new to the blog world but I’m trying to get started and set up my own. Do you need any coding knowledge to make your own blog? Any help would be greatly appreciated!|

  15. Hello! This is kind of off topic but I need some help from an established blog. Is it very hard to set up your own blog? I’m not very techincal but I can figure things out pretty fast. I’m thinking about setting up my own but I’m not sure where to start. Do you have any ideas or suggestions? Cheers|

  16. What i don’t realize is in fact how you’re no longer really much more smartly-appreciated than you may be now. You are so intelligent. You already know therefore considerably when it comes to this subject, produced me personally imagine it from numerous varied angles. Its like women and men are not interested except it is something to accomplish with Girl gaga! Your own stuffs great. Always handle it up!|

  17. Great items from you, man. I’ve consider your stuff prior to and you’re just extremely fantastic. I really like what you’ve got here, certainly like what you are stating and the way in which during which you say it. You make it enjoyable and you continue to take care of to keep it sensible. I can’t wait to read far more from you. This is really a terrific web site.|

  18. Greetings I am so excited I found your blog page, I really found you by accident, while I was browsing on Yahoo for something else, Anyhow I am here now and would just like to say thank you for a remarkable post and a all round thrilling blog (I also love the theme/design), I don’t have time to read through it all at the moment but I have book-marked it and also included your RSS feeds, so when I have time I will be back to read much more, Please do keep up the awesome work.|

  19. It’s actually very difficult in this busy life to listen news on Television, therefore I simply use world wide web for that reason, and obtain the latest information.|

  20. Hi, I do believe this is a great website. I stumbledupon it 😉 I’m going to come back once again since i have saved as a favorite it. Money and freedom is the best way to change, may you be rich and continue to help other people.|

  21. I don’t even know how I ended up here, but I thought this post was great. I do not know who you are but certainly you’re going to a famous blogger if you are not already 😉 Cheers!|

  22. Great beat ! I wish to apprentice while you amend your web site, how can i subscribe for a blog website? The account aided me a acceptable deal. I had been a little bit acquainted of this your broadcast offered bright clear idea|

  23. Heya i am for the primary time here. I came across this board and I to find It truly helpful & it helped me out a lot. I’m hoping to give one thing back and help others such as you helped me.|

  24. hi!,I love your writing very much! share we keep in touch more approximately your post on AOL? I need an expert on this space to unravel my problem. Maybe that’s you! Looking forward to see you. |

  25. This is the right blog for anyone who wishes to find out about this topic. You understand a whole lot its almost hard to argue with you (not that I actually will need to…HaHa). You definitely put a fresh spin on a subject which has been discussed for decades. Great stuff, just excellent!|

  26. Terrific article! This is the type of information that are supposed to be shared across the web. Disgrace on the seek engines for no longer positioning this put up higher! Come on over and seek advice from my web site . Thanks =)|

  27. Great article! That is the kind of information that are supposed to be shared across the internet. Shame on the search engines for no longer positioning this publish higher! Come on over and seek advice from my web site . Thank you =)|

  28. I think this is among the most significant info for me. And i am glad reading your article. But wanna remark on some general things, The site style is perfect, the articles is really great : D. Good job, cheers|

  29. You really make it seem so easy with your presentation but I find this matter to be really something which I think I would never understand. It seems too complicated and extremely broad for me. I am looking forward for your next post, I will try to get the hang of it!|

  30. Hi there! I know this is kinda off topic however I’d figured I’d ask. Would you be interested in trading links or maybe guest writing a blog article or vice-versa? My blog addresses a lot of the same topics as yours and I believe we could greatly benefit from each other. If you might be interested feel free to send me an email. I look forward to hearing from you! Awesome blog by the way!|

  31. I blog quite often and I truly thank you for your information. This article has truly peaked my interest. I will take a note of your website and keep checking for new information about once per week. I subscribed to your RSS feed too.|

  32. I was curious if you ever considered changing the layout of your blog? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having 1 or two pictures. Maybe you could space it out better?|

  33. Hmm it seems like your site ate my first comment (it was super long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I as well am an aspiring blog blogger but I’m still new to everything. Do you have any suggestions for first-time blog writers? I’d definitely appreciate it.|

  34. Thanks for another excellent post. The place else may just anybody get that type of info in such an ideal way of writing? I’ve a presentation subsequent week, and I am at the look for such info.|

  35. Sweet blog! I found it while searching on Yahoo News. Do you have any suggestions on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Cheers|

  36. Hmm it seems like your blog ate my first comment (it was super long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I too am an aspiring blog writer but I’m still new to the whole thing. Do you have any points for first-time blog writers? I’d certainly appreciate it.|

  37. I was curious if you ever thought of changing the page layout of your site? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having 1 or 2 pictures. Maybe you could space it out better?|

  38. wonderful publish, very informative. I wonder why the opposite specialists of this sector do not understand this. You must proceed your writing. I’m confident, you’ve a great readers’ base already!|

  39. We’re a group of volunteers and starting a new scheme in our community. Your site offered us with valuable information to work on. You have done an impressive job and our entire community will be thankful to you.|

Leave a Reply

Your email address will not be published.

Enjoy the tutorial? Please spread the word :)

Follow by Email
Facebook
Facebook
Google+2k
Google+
http://hirdeshbhardwaj.com/2017/01/25/javascript-basics
YouTube49
YouTube