M2 - Describe the purpose and function of JavaScript and JQuery
Introduction
When developing a website, there are various things
involved. There is the design/presentation and also the coding that goes with
it. Websites are mostly made for audience to access and use so therefore they
have to be responsive and cater for the user’s device. JavaScript
possesses many of the features of a programming languages however it is not a programming
language. It is a key tool used in web design for various reasons and also Jquery is also often an
essential tool when creating a website. This document will be covering the purpose
and the functions of JavaScript and Jquery the scripting languages used in web
design.
JavaScript
JavaScript is simply a scripting language used for creating
interactive websites. JavaScript in websites are used for situations where
validation is required and also to make the webpage interactive.
This is a
client side language which means it functions on the user's computer and does
not have anything to do with the server of the website. IT DOES
JavaScript works with
the browser and is executed by the browser which means that there is no
required software application needed to run it. JavaScript is used in
validation of pages and a prime example is the error pop up messages given
when you miss out a mandatory part of an online form. JavaScript is popular due
to the fact that it is widely supported by all the browsers available. In Currently with the advancement of technology, users mostly access websites
on their portable devices like phones and tablets and JavaScript is used in
websites in order for the website to adapt and render the site to the sizing of
the screen of the device being used to access the website. Also websites are
mostly made for the purpose of giving information, marketing and also
e-commerce which means that the users will have to interact with the website in
order to shop or gain information and JavaScript is used to create the
interactive features in the website like slideshows and dropdown box that helps in
navigation.
JavaScript has similiarities to other programming language to an extent, an example of how it is similar to programming languages is the fact that it has features like variables, IF statements etc. Using conditional statements like IF statements allows the developer to use JavaScript for validation and a validation could be if a firstname on a form page is blank, a pop up alert message will display to alert the user of this error.
JavaScript is not capable of formatting the users hard disk unlike programming language which is capable of doing so. This is a high risk when it comes to languages that execute on the users computer so JavaScript is safe when it comes to the language affecting the users data integrity.
JQuery
JQuery is a pre-coded JavaScript; this can be referred to
as a library where JavaScript is stored for web designers to use. This mainly
stores open-source JavaScript. JQuery enables the developer to easily utilise
open-source JavaScript available which is one of the main purpose of JQuery. JQuery
saves time when developing a website as it enables the web designer to utilise JavaScript's
fast without having to write out the code and this reduces the chances of making any sort of error. This also allows the developer to include the basic JavaScript available in the Jquery quickly without having to always retype it as it can be called upon by the developer. The lines of code that comes from JQuery is laid out in a simple and short manner which makes it easier to understand the code and spot any errors or unwanted code.
Example of code
JavaScript
Function changeBachground(color) {
Document.body.style.background = color;
}
Onload=”changeBackground (‘blue’);”
jQuery
$ (‘body’) .css (‘background’, ‘#ccc’);
Reference
W3schools.com. (2016). JavaScript Tutorial. [online] Available at: http://www.w3schools.com/js/ [Accessed 17 May 2016].
W3schools.com. (2016). jQuery Tutorial. [online] Available at: http://www.w3schools.com/jquery/ [Accessed 17 May 2016].
Wikipedia. (2016). JQuery. [online] Available at: https://en.wikipedia.org/wiki/JQuery [Accessed 18 May 2016].
No comments:
Post a Comment